aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rip.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-17 08:43:40 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-08-17 08:43:40 +0000
commitdb4cbf9537f2a2fa3819bd0531906fe92589b070 (patch)
tree3d7ab038ea67f61a56803e72965acf1381abce2e /epan/dissectors/packet-rip.c
parent2046fd75b8463600aa067eecd2510c633f3f0c15 (diff)
remove g_malloc() from rip remove one g_malloc() from tacacs
svn path=/trunk/; revision=15380
Diffstat (limited to 'epan/dissectors/packet-rip.c')
-rw-r--r--epan/dissectors/packet-rip.c17
1 files changed, 5 insertions, 12 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];