[commit: ghc] ghc-7.8: rts: Fix memory leak when loading ELF objects (8404e80)

git at git.haskell.org git at git.haskell.org
Tue Apr 29 21:10:28 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/8404e800a35380281a218c78a6799ed6836b6fad/ghc

>---------------------------------------------------------------

commit 8404e800a35380281a218c78a6799ed6836b6fad
Author: Austin Seipp <austin at well-typed.com>
Date:   Tue Apr 29 09:09:25 2014 -0500

    rts: Fix memory leak when loading ELF objects
    
    Issue discovered by Coverity Scan, CID 43168.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    (cherry picked from commit b7278d3d7bbe384eee7538b1e50bb741e99fb01d)


>---------------------------------------------------------------

8404e800a35380281a218c78a6799ed6836b6fad
 rts/Linker.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index 75389d5..26c7bc9 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1878,6 +1878,7 @@ addDLL( pathchar *dll_name )
             // success -- try to dlopen the first named file
             IF_DEBUG(linker, debugBelch("match%s\n",""));
             line[match[2].rm_eo] = '\0';
+            stgFree((void*)errmsg); // Free old message before creating new one
             errmsg = internal_dlopen(line+match[2].rm_so);
             break;
          }



More information about the ghc-commits mailing list