[nasm:master] outmacho.c: macho_dbg_linenum - fix memory leak

nasm-bot for Cyrill Gorcunov gorcunov at gmail.com
Sun Oct 4 13:48:06 PDT 2020


Commit-ID:  78f14ab1a63963fd302ce7ecc48b6a9df5442675
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=78f14ab1a63963fd302ce7ecc48b6a9df5442675
Author:     Cyrill Gorcunov <gorcunov at gmail.com>
AuthorDate: Sun, 4 Oct 2020 23:45:04 +0300
Committer:  Cyrill Gorcunov <gorcunov at gmail.com>
CommitDate: Sun, 4 Oct 2020 23:45:04 +0300

outmacho.c: macho_dbg_linenum - fix memory leak

If new list is not needed then we should free memory
allocated by nasm_basename and nasm_dirname calls.

CID 1432930

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>


---
 output/outmacho.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/output/outmacho.c b/output/outmacho.c
index 7ec3e752..53c6fa73 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -2139,6 +2139,9 @@ static void macho_dbg_linenum(const char *file_name, int32_t line_num, int32_t s
 
         if(need_new_list) {
             new_file_list(cur_file, cur_dir);
+        } else {
+            nasm_free((void *)cur_file);
+            nasm_free((void *)cur_dir);
         }
     }
 


More information about the Nasm-commits mailing list