diff options
author | Moshe Kaplan <me@moshekaplan.com> | 2020-12-07 08:04:40 -0500 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2020-12-12 17:29:57 +0000 |
commit | cea77caf41ba479aff9d860821ba68629b8df107 (patch) | |
tree | 49389924fd20921b3f37b68b9590d5c283111bca /cli_main.c | |
parent | 001d0debdc4e63ba1e191155d8eff1df9f85b17a (diff) |
cli-main.c: free() argv's memory
free() memory allocated for argv to fix
Coverity 1108127, which detected it as
a resource leak.
Diffstat (limited to 'cli_main.c')
-rw-r--r-- | cli_main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cli_main.c b/cli_main.c index 61c8c58ae7..a478e3d339 100644 --- a/cli_main.c +++ b/cli_main.c @@ -26,6 +26,7 @@ wmain(int argc, wchar_t *wc_argv[]) { char **argv; int i; + int return_code; argv = (char **)malloc((argc + 1) * sizeof(char *)); if (argv == NULL) { @@ -67,6 +68,11 @@ wmain(int argc, wchar_t *wc_argv[]) * the cli_main.h header file since either "main" or "wmain" can be * defined on Windows, but not both. */ - return real_main(argc, argv); + return_code = real_main(argc, argv); + for (i = 0; i < argc; i++) { + free(argv[i]); + } + free(argv); + return return_code; } #endif |