aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2020-10-05 00:20:05 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2020-10-05 00:20:05 +0300
commit19ab41466bdfa3df188228d734f58f77cb525400 (patch)
treeb886cf1619902f5e81e499c4ff3cc8e25b10df5f
parent5e587fda09597b6b697b7d5799562dcc6ca2e4f7 (diff)
downloadnasm-19ab41466bdfa3df188228d734f58f77cb525400.tar.gz
nasm-19ab41466bdfa3df188228d734f58f77cb525400.tar.xz
nasm-19ab41466bdfa3df188228d734f58f77cb525400.zip
outmacho: macho_dbg_linenum -- fix memory leak
In 78f14ab1a63963fd302ce7ecc48b6a9df5442675 the fix is incomplete, we should move free procedure out of the list_for_each traverse. CID 1432930 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outmacho.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/output/outmacho.c b/output/outmacho.c
index 53c6fa73..d041df64 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -2137,12 +2137,13 @@ static void macho_dbg_linenum(const char *file_name, int32_t line_num, int32_t s
}
}
- if(need_new_list) {
+ if (need_new_list)
new_file_list(cur_file, cur_dir);
- } else {
+ }
+
+ if (!need_new_list) {
nasm_free((void *)cur_file);
nasm_free((void *)cur_dir);
- }
}
dbg_immcall = true;