#642 memory leak in readCheckMacroString()

open
nobody
Program (402)
5
2008-08-27
2008-08-27
Bert Wesarg
No

I think there are memory leaks of the compiled program in case runWindow == NULL (aka macro checking). And for the case runWindow != NULL and runWindow->macroCmdData != NULL I'm not sure.

Discussion

  • Bert Wesarg

    Bert Wesarg - 2008-09-16

    I think I have an idea, how to prevent this memory leak, of the just compiled program (which are run with RunMacroAsSubrCall):

    before setting up the new frame for this program, setup a pseudo frame, which has as code a function which free the program on top of the stack, and push the to be run program onto the stack. Therefore, if the program returns, this pseudo stack is executed, which frees the program.

     
  • Bert Wesarg

    Bert Wesarg - 2008-09-16

    Ok, here is a patch:

    it calls FreeProgram() in the case runWindow == NULL.

    The other case is not a leak, because runMacro() is responsible for freeing the prog.

    This is only a smal step, as pointed out in some new comments there are more leaks.
    File Added: fix-memleak-in-readCheckMacroString.patch.txt

     
  • Bert Wesarg

    Bert Wesarg - 2008-09-16

    This is an implementation of my 'pseudo frame' idea. Patch applies after disable-FreeProgram.patch.txt from BUG#2113904 (which applies after fix-memleak-in-readCheckMacroString.patch.txt).

    File Added: FreeProgram-after-RunMacroAsSubrCall.patch.txt

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks