Fixing issues found by prevent2 (49866)
authorKarol Pawlowski <k.pawlowski@samsung.com>
Wed, 24 Apr 2013 11:32:50 +0000 (13:32 +0200)
committerKarol Pawlowski <k.pawlowski@samsung.com>
Wed, 24 Apr 2013 11:34:19 +0000 (13:34 +0200)
[Issue#] LINUXWRT-234
[Bug] Dereference null return value
[Cause] N/A
[Solution] Remove issues
[Verification] Build wrt-installer repository
run: wrt-installer -p
additionally you can run wrt-installer-tests-general --output=text --regexp='pluginFilesAdded'
to run tests you should build repository with flag --define="WITH_TESTS ON"

Change-Id: I62db6e501f17170b9f2a799fa596971212d47843

src/jobs/plugin_install/plugin_install_task.cpp

index 4c87f62..65333ba 100644 (file)
@@ -187,9 +187,10 @@ void PluginInstallTask::stepLoadPluginLibrary()
 
     void *dlHandle = dlopen(filename.c_str(), RTLD_LAZY);
     if (dlHandle == NULL) {
+        const char* error = (const char*)dlerror();
         LogError(
             "Failed to load plugin: " << filename <<
-            ". Reason: " << (dlerror() != NULL ? dlerror() : "unknown"));
+            ". Reason: " << (error != NULL ? error : "unknown"));
         ThrowMsg(Exceptions::PluginLibraryError, "Library error");
     }