From: Fabian Maurer dark.shadow4@web.de
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- programs/extrac32/extrac32.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c index 3741f16b3cd..d4e7149bdde 100644 --- a/programs/extrac32/extrac32.c +++ b/programs/extrac32/extrac32.c @@ -268,29 +268,29 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho force_mode = TRUE; break; case 'L': - if ((i + 1) >= argc) return 0; + if ((i + 1) >= argc) goto cleanup; if (!GetFullPathNameW(argv[++i], MAX_PATH, path, NULL)) - return 0; + goto cleanup; break; case 'C': case 'E': case 'D': - if (cmd) return 0; + if (cmd) goto cleanup; cmd = check; break; default: - return 0; + goto cleanup; } }
if (!cabfile) - return 0; + goto cleanup;
if (cmd == 'C') { - if ((i + 1) != argc) return 0; + if ((i + 1) != argc) goto cleanup; if (!GetFullPathNameW(argv[i], MAX_PATH, path, NULL)) - return 0; + goto cleanup; } else if (!cmd) /* Use extraction by default if names of required files presents */ @@ -317,5 +317,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho extract(cabfile, path); break; } +cleanup: + HeapFree(GetProcessHeap(), 0, argv); return 0; }
It's going to exit anyway, so cleaning up is not very important.
On Wed Nov 2 05:38:20 2022 +0000, Nikolay Sivov wrote:
It's going to exit anyway, so cleaning up is not very important.
I know, but then again, it helps avoid a warning from a static analysis tool. `get_extrac_args` uses HeapFree as well, and IMHO it's cleaner to do.
This merge request was closed by Alexandre Julliard.
I know, but then again, it helps avoid a warning from a static analysis tool. `get_extrac_args` uses HeapFree as well, and IMHO it's cleaner to do.
Freeing memory on process exit is a waste of time, and it's adding unnecessary complexity. Please don't do that.