diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-06-19 11:58:21 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-19 18:58:49 +0000 |
commit | 46ecf18fbdb6f02b1748ca72bd5e6ecf0e6c0886 (patch) | |
tree | 8825c184d1932efca50cfe4aabd4e7798cdefd1a /epan/dissectors/packet-tacacs.c | |
parent | 83762f9f9be517ef155f5b0649962809ba593550 (diff) |
Use address_to_str(NULL, ...) for strings allocated outside dissectors.
ep_address_to_str() doesn't crash if called outside packet scope, but
it's still not correct to use outside packet scope. Use
address_to_str(NULL, ...) to allocate those strings, and then explicitly
free them when we're done; exceptions don't get thrown between the
allocate and free, so there's no risk of a leak.
Change-Id: Iea2af93b0757e648d399e2ba64249224eb7e9e3c
Reviewed-on: https://code.wireshark.org/review/2438
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-tacacs.c')
-rw-r--r-- | epan/dissectors/packet-tacacs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index e663c72997..7d133a8a60 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -748,13 +748,17 @@ static void tacplus_print_key_entry( gpointer data, gpointer user_data ) { tacplus_key_entry *tacplus_data=(tacplus_key_entry *)data; + gchar *s_str, *c_str; + + s_str = address_to_str( NULL, tacplus_data->s ); + c_str = address_to_str( NULL, tacplus_data->c ); if( user_data ) { - printf("%s:%s=%s\n", ep_address_to_str( tacplus_data->s ), - ep_address_to_str( tacplus_data->c ), tacplus_data->k ); + printf("%s:%s=%s\n", s_str, c_str, tacplus_data->k ); } else { - printf("%s:%s\n", ep_address_to_str( tacplus_data->s ), - ep_address_to_str( tacplus_data->c ) ); + printf("%s:%s\n", s_str, c_str ); } + wmem_free(NULL, s_str); + wmem_free(NULL, c_str); } #endif static int |