]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Resolve Coverity RESOURCE_LEAK
authorWang Rui <moon.wangrui@huawei.com>
Thu, 28 Aug 2014 10:20:57 +0000 (18:20 +0800)
committerJán Tomko <jtomko@redhat.com>
Thu, 28 Aug 2014 10:52:42 +0000 (12:52 +0200)
The 'lib' handle will be leaked if 'dlsym' condition fails.
So close the handle before return.

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
tests/shunloadtest.c

index 499b1be5d4e08999d7cb39e3bea70eee0a15d120..80f535134f04bae59821a2eb31b8167884abdfd0 100644 (file)
@@ -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;
     }