diff options
author | Dario Lombardo <lomato@gmail.com> | 2017-02-09 18:06:45 +0100 |
---|---|---|
committer | Dario Lombardo <lomato@gmail.com> | 2017-02-27 13:25:26 +0000 |
commit | a29fe9d76afe04ae80caebfb4239d3b5a8318183 (patch) | |
tree | 03404d190869439aebb119f1e58f0b82a4cee2dd | |
parent | d4cf57100ce10930551b1985eac77e78bae6361d (diff) |
print_stream: free memory on exit.
Change-Id: I6c4acaa9026cfdf1d4230c28c30bccfb6c025cef
Reviewed-on: https://code.wireshark.org/review/19920
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
-rw-r--r-- | epan/print_stream.c | 2 | ||||
-rw-r--r-- | tfshark.c | 1 | ||||
-rw-r--r-- | tshark.c | 3 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.c | 1 |
4 files changed, 5 insertions, 2 deletions
diff --git a/epan/print_stream.c b/epan/print_stream.c index 0bd2846c30..da58960c04 100644 --- a/epan/print_stream.c +++ b/epan/print_stream.c @@ -98,7 +98,7 @@ print_finale(print_stream_t *self) gboolean destroy_print_stream(print_stream_t *self) { - return self->ops->destroy ? (self->ops->destroy)(self) : TRUE; + return (self && self->ops && self->ops->destroy) ? (self->ops->destroy)(self) : TRUE; } typedef struct { @@ -1054,6 +1054,7 @@ main(int argc, char *argv[]) funnel_dump_all_text_windows(); clean_exit: + destroy_print_stream(print_stream); epan_free(cfile.epan); epan_cleanup(); #ifdef HAVE_EXTCAP @@ -185,7 +185,7 @@ static gboolean line_buffered; static gboolean really_quiet = FALSE; static print_format_e print_format = PR_FMT_TEXT; -static print_stream_t *print_stream; +static print_stream_t *print_stream = NULL; static output_fields_t* output_fields = NULL; static gchar **protocolfilter = NULL; @@ -2205,6 +2205,7 @@ main(int argc, char *argv[]) output_fields = NULL; clean_exit: + destroy_print_stream(print_stream); #ifdef HAVE_LIBPCAP capture_opts_cleanup(&global_capture_opts); #endif diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index 7c25f16378..2f3a014c73 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -684,6 +684,7 @@ win32_export_file(HWND h_wnd, capture_file *cf, export_type_e export_type) { print_args.print_dissections = print_dissections_as_displayed; print_args.print_hex = FALSE; print_args.print_formfeed = FALSE; + print_args.stream = NULL; if (GetSaveFileName(ofn)) { print_args.file = utf_16to8(file_name); |