[Nasm-bugs] [Bug 3392791] New: ofmt->cleanup() is not called in case of an assembly error

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Mon Jan 31 14:13:50 PST 2022


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

            Bug ID: 3392791
           Summary: ofmt->cleanup() is not called in case of an assembly
                    error
           Product: NASM
           Version: 2.15.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: minor
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: shooshx 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: Build from source archive using configure

Looking at the code in nasm.c in the main function ofmt->cleanup() is called
only under the branch of of (!terminate_after_phase) and this branch doesn't
seem to be taken when there's an error reported.

command line:
> nasm.exe source.asm -l out.lst
to build a simple bin file.

But actually I'm not really using the command line to run nasm.
I found this while running nasm compiled into asm.js using emscripten.
I'm running nasm repeatedly many times over and over again in the same memory
space and I noticed over time there's a memory leak. I wrote some code to track
memory allocations and traces some of the larger leaks to bin_cleanup() not
being called.

This is part of this project:
https://shooshx.github.io/corewars8086_js/war/page.html

my minor additions to the code to make it work properly in this way are mostly
here:
https://github.com/shooshx/corewars8086_js/blob/master/assembler/nasm/asm/nasm.c#L1911

-- 
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