diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-08-08 18:50:39 +0000 |
commit | 0dc9fb3d4ab00d14bf45c597471e10e601efd4d4 (patch) | |
tree | ae44175ca8fd23548fcec5833098b535af5e372c /epan/follow.c | |
parent | f3407856f4fd97caf90655205cdb2c66991e75ba (diff) | |
download | wireshark-0dc9fb3d4ab00d14bf45c597471e10e601efd4d4.tar.gz wireshark-0dc9fb3d4ab00d14bf45c597471e10e601efd4d4.tar.bz2 wireshark-0dc9fb3d4ab00d14bf45c597471e10e601efd4d4.zip |
various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants
svn path=/trunk/; revision=15264
Diffstat (limited to 'epan/follow.c')
-rw-r--r-- | epan/follow.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/epan/follow.c b/epan/follow.c index 429e077338..f1dc7ccbad 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -80,12 +80,12 @@ follow_tcp_stats(follow_tcp_stats_t* stats) very good one */ char* build_follow_filter( packet_info *pi ) { - char* buf = g_malloc(1024); + char* buf; int len; if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 && pi->ipproto == 6 ) { /* TCP over IPv4 */ - sprintf( buf, + buf = g_strdup_printf( "(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", ip_to_str( pi->net_src.data), ip_to_str( pi->net_dst.data), @@ -96,7 +96,7 @@ build_follow_filter( packet_info *pi ) { else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 && pi->ipproto == 6 ) { /* TCP over IPv6 */ - sprintf( buf, + buf = g_strdup_printf( "(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", ip6_to_str((const struct e_in6_addr *)pi->net_src.data), ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), @@ -105,7 +105,6 @@ build_follow_filter( packet_info *pi ) { is_ipv6 = TRUE; } else { - g_free( buf ); return NULL; } memcpy(ip_address[0], pi->net_src.data, len); |