From 4b05159dfec9e3e4495982e70803d7d49c13f54b Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 10 Sep 2016 01:25:55 +0200 Subject: capinfos: fix memleaks Change-Id: Ib3145bb13d2a72c16f9c219fa19321e44958a30e Reviewed-on: https://code.wireshark.org/review/17622 Reviewed-by: Peter Wu --- capinfos.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'capinfos.c') diff --git a/capinfos.c b/capinfos.c index 9d0901da4d..beef85ecc0 100644 --- a/capinfos.c +++ b/capinfos.c @@ -1443,6 +1443,8 @@ main(int argc, char *argv[]) "\n" "%s", get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str); + g_string_free(comp_info_str, TRUE); + g_string_free(runtime_info_str, TRUE); #ifdef _WIN32 arg_list_utf_16to8(argc, argv); @@ -1642,6 +1644,8 @@ main(int argc, char *argv[]) break; case 'v': + comp_info_str = get_compiled_version_info(NULL, NULL); + runtime_info_str = get_runtime_version_info(NULL); show_version("Capinfos (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); @@ -1712,7 +1716,7 @@ main(int argc, char *argv[]) } overall_error_status = 1; /* remember that an error has occurred */ if (!continue_after_wtap_open_offline_failure) - exit(1); /* error status */ + goto exit; } if (wth) { @@ -1721,11 +1725,17 @@ main(int argc, char *argv[]) status = process_cap_file(wth, argv[opt]); wtap_close(wth); - if (status) - exit(status); + if (status) { + overall_error_status = status; + goto exit; + } } } +exit: +#ifdef HAVE_LIBGCRYPT + g_free(hash_buf); +#endif return overall_error_status; } -- cgit v1.2.1