From: Jens Remus Date: Mon, 27 Jan 2025 15:43:39 +0000 (+0100) Subject: s390: s390_machinemode leak X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bda1fb42f3ba7b06d38a9f8277c40ad37226a51;p=thirdparty%2Fbinutils-gdb.git s390: s390_machinemode leak This resolves the following memory leak reported by ASAN: Direct leak of 17 byte(s) in 1 object(s) allocated from: #0 0x3ffb32fbb1d in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x2aa149861cf in xmalloc ../../libiberty/xmalloc.c:149 #2 0x2aa149868ff in xstrdup ../../libiberty/xstrdup.c:34 #3 0x2aa1312391f in s390_machinemode ../../gas/config/tc-s390.c:2241 #4 0x2aa130ddc7b in read_a_source_file ../../gas/read.c:1293 #5 0x2aa1304f7bf in perform_an_assembly_pass ../../gas/as.c:1223 #6 0x2aa1304f7bf in main ../../gas/as.c:1436 #7 0x3ffb282be35 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #8 0x3ffb282bf33 in __libc_start_main_impl ../csu/libc-start.c:360 #9 0x2aa1305758f (/home/jremus/git/binutils/build-asan/gas/as-new+0x2d5758f) (BuildId: ...) gas/ * config/tc-s390.c (s390_machinemode): Free mode_string before returning. Signed-off-by: Jens Remus --- diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index e7a7e7e04f1..113b9f41a1e 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -2287,6 +2287,7 @@ s390_machinemode (int ignore ATTRIBUTE_UNUSED) s390_setup_opcodes (); } + xfree (mode_string); demand_empty_rest_of_line (); }