[commit: ghc] master: rts: Fix memory leak when loading ELF objects (b7278d3)

git at git.haskell.org git at git.haskell.org
Tue Apr 29 19:14:39 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7278d3d7bbe384eee7538b1e50bb741e99fb01d/ghc

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

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


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

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

diff --git a/rts/Linker.c b/rts/Linker.c
index 146e2d5..ea7c1c6 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1900,6 +1900,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