Changeset: e3ebf40c1553 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3ebf40c1553
Modified Files:
        monetdb5/mal/mal_linker.c
Branch: default
Log Message:

Handle should be closed in case of malloc failure


diffs (21 lines):

diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -240,12 +240,16 @@ loadLibrary(str filename, int flag)
                filesLoaded[lastfile].modname = GDKstrdup(filename);
                if(filesLoaded[lastfile].modname == NULL) {
                        MT_lock_unset(&mal_contextLock);
+                       if (handle)
+                               dlclose(handle);
                        throw(LOADER, "loadLibrary", RUNTIME_LOAD_ERROR " could 
not allocate space");
                }
                filesLoaded[lastfile].fullname = GDKstrdup(handle ? nme : "");
                if(filesLoaded[lastfile].fullname == NULL) {
+                       MT_lock_unset(&mal_contextLock);
                        GDKfree(filesLoaded[lastfile].modname);
-                       MT_lock_unset(&mal_contextLock);
+                       if (handle)
+                               dlclose(handle);
                        throw(LOADER, "loadLibrary", RUNTIME_LOAD_ERROR " could 
not allocate space");
                }
                filesLoaded[lastfile].handle = handle ? handle : 
filesLoaded[0].handle;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to