From db4cbf9537f2a2fa3819bd0531906fe92589b070 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 17 Aug 2005 08:43:40 +0000 Subject: remove g_malloc() from rip remove one g_malloc() from tacacs svn path=/trunk/; revision=15380 --- epan/dissectors/packet-rip.c | 17 +++++------------ epan/dissectors/packet-tacacs.c | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-rip.c b/epan/dissectors/packet-rip.c index a39a14a841..3947bf9bc0 100644 --- a/epan/dissectors/packet-rip.c +++ b/epan/dissectors/packet-rip.c @@ -32,6 +32,7 @@ #include #include #include +#include #define UDP_PORT_RIP 520 @@ -237,8 +238,8 @@ dissect_ip_rip_vektor(tvbuff_t *tvb, int offset, guint8 version, static gchar * rip_bytestring_to_str(const guint8 *ad, guint32 len, char punct) { - static gchar *str=NULL; - static guint str_len; + gchar *str=NULL; + guint str_len; gchar *p; int i; guint32 octet; @@ -252,16 +253,8 @@ rip_bytestring_to_str(const guint8 *ad, guint32 len, char punct) { { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - if( !str ) { - str_len=sizeof(gchar)*len*(punct?3:2); - str=g_malloc(str_len); - } else { - if( str_len < (sizeof(gchar)*len*(punct?3:2)) ) { - g_free(str); - str_len=sizeof(gchar)*len*(punct?3:2); - str=g_malloc(str_len); - } - } + str_len=sizeof(gchar)*len*(punct?3:2); + str=ep_alloc(str_len); len--; p = &str[str_len]; diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index 6e4f7cac7b..0c40722d3f 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -67,6 +67,7 @@ #include #include +#include #include "packet-tacacs.h" static void md5_xor( guint8 *data, const char *key, int data_len, guint8 *session_id, guint8 version, guint8 seq_no ); @@ -1121,7 +1122,7 @@ md5_xor( guint8 *data, const char *key, int data_len, guint8 *session_id, guint8 md5_len = 4 /* sizeof(session_id) */ + strlen(key) + sizeof(version) + sizeof(seq_no); - md5_buff = (md5_byte_t*)g_malloc(md5_len+MD5_LEN); + md5_buff = (md5_byte_t*)ep_alloc(md5_len+MD5_LEN); mdp = md5_buff; @@ -1151,5 +1152,4 @@ md5_xor( guint8 *data, const char *key, int data_len, guint8 *session_id, guint8 md5_append(&mdcontext, md5_buff, md5_len); md5_finish(&mdcontext,hash); } - g_free( md5_buff ); } -- cgit v1.2.3