diff options
author | Evan Huus <eapache@gmail.com> | 2012-07-22 22:01:10 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-07-22 22:01:10 +0000 |
commit | 10c9e218122e19a9784a1c4a6b6b06da2df822ff (patch) | |
tree | 845362b35e5a5902c3689331f55eaefded039ca7 /tshark.c | |
parent | daa0ff3ac80126abf74110a8fdb13a38369ba089 (diff) | |
download | wireshark-10c9e218122e19a9784a1c4a6b6b06da2df822ff.tar.gz |
Only initialize fields in the print_args that are actually used.
This prevents a memory leak where we were allocating for print_args.range
but never freeing.
svn path=/trunk/; revision=43921
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -3416,15 +3416,17 @@ print_packet(capture_file *cf, epan_dissect_t *edt) switch (output_action) { case WRITE_TEXT: + /* Only initialize the fields that are actually used in proto_tree_print. + * This is particularly important for .range, as that's heap memory which + * we would otherwise have to g_free(). print_args.to_file = TRUE; print_args.format = print_format; print_args.print_summary = !verbose; - print_args.print_hex = verbose && print_hex; print_args.print_formfeed = FALSE; - print_args.print_dissections = verbose ? print_dissections_expanded : print_dissections_none; - - /* init the packet range */ packet_range_init(&print_args.range); + */ + print_args.print_hex = verbose && print_hex; + print_args.print_dissections = verbose ? print_dissections_expanded : print_dissections_none; if (!proto_tree_print(&print_args, edt, print_stream)) return FALSE; |