[PATCH 2/3] tests: Resolve Coverity RESOURCE_LEAK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'lib' handle will be leaked if 'dlsym' condition fails.
So close the handle before return.

Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx>
---
 tests/shunloadtest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/shunloadtest.c b/tests/shunloadtest.c
index 499b1be..80f5351 100644
--- a/tests/shunloadtest.c
+++ b/tests/shunloadtest.c
@@ -114,6 +114,7 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv)
     }
     if (!(startup = dlsym(lib, "shunloadStart"))) {
         fprintf(stderr, "Cannot find shunloadStart %s\n", dlerror());
+        dlclose(lib);
         return 1;
     }
 
-- 
1.7.12.4


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]