[Nasm-bugs] [Bug 3392895] New: potential memory leak in unquote_token_anystr function at asm/preproc.c

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun Jul 30 18:39:02 PDT 2023


            Bug ID: 3392895
           Summary: potential memory leak in unquote_token_anystr function
                    at asm/preproc.c
           Product: NASM
           Version: 2.17 (development)
          Hardware: PC
                OS: Linux
            Status: OPEN
          Severity: minor
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: zhangyy0721 at smail.nju.edu.cn
                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

Through our tool's analysis, we may have identified a potential memory leak
risk in the function unquote_token_anystr within the file asm/preproc.c (line

Specifically, when olen <= INLINE_TEXT, the variable 'p' is assigned the value
of 't->text.a', and then directly returned at line 734. 
However, 't->text.p.ptr' is memory allocated using nasm_malloc in the new_Token
function. Consequently, if 'p' is directly returned at line 734, it may result
in 't->text.p.ptr' not being freed, potentially leading to a memory leak.
Is it reasonable to free 't->text.p.ptr' before returning 'p' at line 734?

Git master branch,a916e4127b2eaa3bf40bddf3de9b0ceefc0d98a4

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

More information about the Nasm-bugs mailing list