From 05692cecc6da85ff67e14bcde2ada1a24e1a9c04 Mon Sep 17 00:00:00 2001 From: a13579and2468 Date: Sat, 2 Jul 2022 03:18:33 +0800 Subject: [PATCH] Subject: [PATCH] fix memory leak in asm/nasm.c Bug analysis: When the first argument of nasm is a pathname without '.', forget to free outname before set outname = "nasm.out";. bugzilla: https://bugzilla.nasm.us/show_bug.cgi?id=3392800 Signed-off-by: Szu-Wei Tseng <13579and24680@gmail.com> --- asm/nasm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/nasm.c b/asm/nasm.c index 6af927547..a18f1accf 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -607,6 +607,7 @@ int main(int argc, char **argv) if (!outname && !(operating_mode & OP_PREPROCESS)) { outname = filename_set_extension(inname, ofmt->extension); if (!strcmp(outname, inname)) { + nasm_free((char *)outname); outname = "nasm.out"; nasm_warn(WARN_OTHER, "default output file same as input, using `%s' for output\n", outname); }