[haiku-commits] r39950 - haiku/trunk/src/system/libroot/posix/locale

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 26 Dec 2010 16:26:58 +0100 (CET)

Author: zooey
Date: 2010-12-26 16:26:58 +0100 (Sun, 26 Dec 2010)
New Revision: 39950
Changeset: http://dev.haiku-os.org/changeset/39950

Modified:
   haiku/trunk/src/system/libroot/posix/locale/LocaleBackend.cpp
Log:
Fix CID-5893 (resource leak):
* close the dlopen()-ed image if the locale backend could not be created


Modified: haiku/trunk/src/system/libroot/posix/locale/LocaleBackend.cpp
===================================================================
--- haiku/trunk/src/system/libroot/posix/locale/LocaleBackend.cpp       
2010-12-26 15:19:12 UTC (rev 39949)
+++ haiku/trunk/src/system/libroot/posix/locale/LocaleBackend.cpp       
2010-12-26 15:26:58 UTC (rev 39950)
@@ -32,8 +32,10 @@
        typedef LocaleBackend* (*symbolType)();
        symbolType createInstanceFunc
                = (symbolType)dlsym(imageHandle, "CreateInstance");
-       if (createInstanceFunc == NULL)
+       if (createInstanceFunc == NULL) {
+               dlclose(imageHandle);
                return;
+       }
 
        gLocaleBackend = createInstanceFunc();
 }


Other related posts:

  • » [haiku-commits] r39950 - haiku/trunk/src/system/libroot/posix/locale - zooey