The 'lib' handle will be leaked if 'dlsym' condition fails.
So close the handle before return.
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
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