[Nasm-bugs] [Bug 3392800] New: memory leak in asm/nasm.c:610

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Mon Jul 4 02:21:58 PDT 2022


https://bugzilla.nasm.us/show_bug.cgi?id=3392800

            Bug ID: 3392800
           Summary: memory leak in asm/nasm.c:610
           Product: NASM
           Version: 2.16 (development)
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: 13579and24680 at gmail.com
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Built from git using configure

$ ./nasm myinput/test1  
myinput/test1: warning: default output file same as input, using `nasm.out' for
output
 [-w+other]
nasm: fatal: unable to open input file `myinput/test1' No such file or
directory

=================================================================
==14512==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 14 byte(s) in 1 object(s) allocated from:
    #0 0x7f10ccd7a808 in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x559a339ff044 in nasm_malloc nasmlib/alloc.c:55

SUMMARY: AddressSanitizer: 14 byte(s) leaked in 1 allocation(s).



Analysis :

When the first argument of nasm is a pathname without '.', forget to free
outname before set `outname = "nasm.out";`. (no matter the file exists or not)


Fix : 

I created a PR on github.

https://github.com/netwide-assembler/nasm/pull/31/commits/f14a2d8b7393b4c82cce369c82fb6e352e356f32

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list