From 44535d37b287fd2833b316130881f0b863f361cf Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 23 Dec 2006 00:10:49 +0000 Subject: make ipv4 ftype use cheap ep_ memory isntead of slightly less cheap g_ memory for the temporary storage while parsing svn path=/trunk/; revision=20205 --- epan/ftypes/ftype-ipv4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'epan/ftypes/ftype-ipv4.c') diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index 045c9fbf10..bb81272d5e 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -29,6 +29,7 @@ #include #include #include +#include static void @@ -59,7 +60,7 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (has_slash) { /* Make a copy of the string and use strtok() to * get the address portion. */ - s_copy = g_strdup(s); + s_copy = ep_strdup(s); addr_str = strtok(s_copy, "/"); /* I just checked for slash! I shouldn't get NULL here. @@ -67,7 +68,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!addr_str) { logfunc("Unexpected strtok() error parsing IP address: %s", s_copy); - g_free(s_copy); return FALSE; } } @@ -78,9 +78,6 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!get_host_ipaddr(addr_str, &addr)) { logfunc("\"%s\" is not a valid hostname or IPv4 address.", addr_str); - if (has_slash) { - g_free(s_copy); - } return FALSE; } @@ -94,13 +91,11 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu if (!net_str) { logfunc("Unexpected strtok() error parsing netmask: %s", s_copy); - g_free(s_copy); return FALSE; } /* XXX - this is inefficient */ nmask_fvalue = fvalue_from_unparsed(FT_UINT32, net_str, FALSE, logfunc); - g_free(s_copy); if (!nmask_fvalue) { return FALSE; } -- cgit v1.2.1