diff options
author | Peter Wu <peter@lekensteyn.nl> | 2016-09-10 01:27:28 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2016-09-10 13:00:22 +0000 |
commit | e5fef1d73e687807ae1df40979ffc5a65dda03cc (patch) | |
tree | 5d220881bf0dde6ec2a9a192b5c99d08136e79b6 | |
parent | 4b05159dfec9e3e4495982e70803d7d49c13f54b (diff) | |
download | wireshark-e5fef1d73e687807ae1df40979ffc5a65dda03cc.tar.gz |
Fix version-string releated memleak for some CLI tools
These programs resulted on a memleak report on exit.
Change-Id: I630618f50d723b7af4cb00ba29671d4e7c6fcdc2
Reviewed-on: https://code.wireshark.org/review/17623
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r-- | captype.c | 4 | ||||
-rw-r--r-- | mergecap.c | 4 | ||||
-rw-r--r-- | text2pcap.c | 4 | ||||
-rw-r--r-- | tfshark.c | 6 |
4 files changed, 16 insertions, 2 deletions
@@ -118,6 +118,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); @@ -168,6 +170,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("Captype (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); diff --git a/mergecap.c b/mergecap.c index 089ef0254d..1476e0fe5d 100644 --- a/mergecap.c +++ b/mergecap.c @@ -291,6 +291,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); /* * Get credential information for later use. @@ -368,6 +370,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("Mergecap (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); diff --git a/text2pcap.c b/text2pcap.c index d364984d62..855df5e54c 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -1467,6 +1467,8 @@ parse_options (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); /* Scan CLI parameters */ while ((c = getopt_long(argc, argv, "aDdhqe:i:l:m:no:u:s:S:t:T:v4:6:", long_options, NULL)) != -1) { @@ -1675,6 +1677,8 @@ parse_options (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("Text2pcap (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); @@ -420,6 +420,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); /* * In order to have the -X opts assigned before the wslua machine starts @@ -854,7 +856,8 @@ main(int argc, char *argv[]) } break; case 'v': /* Show version and exit */ - { + comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info); + runtime_info_str = get_runtime_version_info(get_tfshark_runtime_version_info); show_version("TFShark (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); @@ -868,7 +871,6 @@ main(int argc, char *argv[]) #endif epan_cleanup(); return 0; - } case 'O': /* Only output these protocols */ /* already processed; just ignore it now */ break; |