From 27580b5f3299a6cb338644382b71b1771e0498c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Wed, 4 Jan 2023 15:17:35 +0100 Subject: [PATCH] Correctly free CRC array --- src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index bc14947..a960f99 100644 --- a/src/main.c +++ b/src/main.c @@ -364,7 +364,7 @@ int main(int argc, char **argv) struct command_line_options cmd_opts; elfpatch_handle_t *ep; int ret = 0; - uint32_t *crcs; + uint32_t *crcs = NULL; prepare_default_opts(&cmd_opts); parse_cmdline_options(&argc, &argv, &cmd_opts); @@ -431,10 +431,13 @@ int main(int argc, char **argv) ret_close_elf: elf_patch_close_and_free(ep); - free_cmds: free_cmd_args(&cmd_opts); + /* Free CRCs if necessary */ + if (crcs) + free(crcs); + return ret; }