Coverity #1321346, #1321347 fixed: Resource Leaks 86/18086/2
Dhruv Khattar [Fri, 15 Apr 2016 11:23:39 +0000 (16:23 +0530)]
Change-Id: Ida86e323dca4ab3e7dea855683d318d1ff478bbb

scilab/modules/dynamic_link/src/cpp/dynamic_link.cpp

index 799a20f..986d2d6 100644 (file)
@@ -195,6 +195,8 @@ int Sci_dlsym(wchar_t* _pwstEntryPointName, int _iLibID, BOOL _bFortran)
     if (_iLibID < 0 || ConfigVariable::isDynamicLibrary(_iLibID) == false)
     {
         //no valid library at this ID
+        FREE(pwstEntryPointName);
+        FREE(pEP);
         return -3;
     }
 
@@ -202,6 +204,8 @@ int Sci_dlsym(wchar_t* _pwstEntryPointName, int _iLibID, BOOL _bFortran)
     if (ConfigVariable::getEntryPoint(_pwstEntryPointName, _iLibID) != NULL)
     {
         sciprint(_("Entry name %ls.\n"), _pwstEntryPointName);
+        FREE(pwstEntryPointName);
+        FREE(pEP);
         return -4;
     }
 
@@ -220,6 +224,8 @@ int Sci_dlsym(wchar_t* _pwstEntryPointName, int _iLibID, BOOL _bFortran)
         {
             sciprint(_("%ls is not an entry point.\n"), _pwstEntryPointName);
         }
+        FREE(pwstEntryPointName);
+        FREE(pEP);
         return -5;
     }