diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-08-17 08:43:40 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-08-17 08:43:40 +0000 |
commit | db4cbf9537f2a2fa3819bd0531906fe92589b070 (patch) | |
tree | 3d7ab038ea67f61a56803e72965acf1381abce2e /epan/dissectors | |
parent | 2046fd75b8463600aa067eecd2510c633f3f0c15 (diff) |
remove g_malloc() from rip remove one g_malloc() from tacacs
svn path=/trunk/; revision=15380
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-rip.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 4 |
2 files changed, 7 insertions, 14 deletions
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 <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/emem.h> #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 <epan/prefs.h> #include <epan/crypt-md5.h> +#include <epan/emem.h> #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 ); } |