diff options
author | Vasil Velichkov <vvvelichkov@gmail.com> | 2018-08-09 03:38:36 +0300 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-08-17 22:20:54 +0000 |
commit | 787d61c0a4bac5136d54027aa71f249e6384b307 (patch) | |
tree | 1471d46aca57a305834451e9ee65d6c2bc4f4f54 /tshark.c | |
parent | b1b98051b293ca3a714b2d91d175bbe126965ab1 (diff) |
tshark: free exp_pdu_filename and capture_opts->save_file
valgrind --tool=memcheck --leak-check=full ./run/tshark -r sctp.pcap -U "OSI layer 3" -w exported.pcap
13 bytes in 1 blocks are definitely lost in loss record 20 of 93
at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
by 0xB27B3C5: g_malloc (gmem.c:99)
by 0xB294D22: g_strdup (gstrfuncs.c:363)
by 0x117B5D: capture_opts_add_opt (capture_opts.c:889)
by 0x118C0E: main (tshark.c:1112)
Change-Id: I9b794015aa4d2626b43a5743864c2d732c6acaa1
Reviewed-on: https://code.wireshark.org/review/29125
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -728,7 +728,7 @@ main(int argc, char *argv[]) int log_flags; gchar *output_only = NULL; gchar *volatile pdu_export_arg = NULL; - const char *volatile exp_pdu_filename = NULL; + char *volatile exp_pdu_filename = NULL; exp_pdu_t exp_pdu_tap_data; #ifdef HAVE_JSONGLIB const gchar* elastic_mapping_filter = NULL; @@ -1113,7 +1113,7 @@ main(int argc, char *argv[]) * Output file name, if we're reading a file and writing to another * file. */ - output_file_name = optarg; + output_file_name = g_strdup(optarg); } else { capture_option_specified = TRUE; arg_error = TRUE; @@ -2078,6 +2078,7 @@ main(int argc, char *argv[]) exit_status = 2; } g_free(pdu_export_arg); + g_free(exp_pdu_filename); } } else { tshark_debug("tshark: no capture file specified"); @@ -2249,6 +2250,8 @@ clean_exit: destroy_print_stream(print_stream); #ifdef HAVE_LIBPCAP capture_opts_cleanup(&global_capture_opts); +#else + g_free(output_file_name); #endif col_cleanup(&cfile.cinfo); free_filter_lists(); |