summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-17 12:58:40 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-01-29 19:26:14 +0100
commit317d423e76f92ca6add0f0eefe459b1cec015aa3 (patch)
tree5f171c204456bd83dfd6869c00660892a49f7c54 /src/tests
parent294547ffbea71f472e0f1ca6797fca99c330f976 (diff)
downloadsssd-317d423e76f92ca6add0f0eefe459b1cec015aa3.tar.gz
sssd-317d423e76f92ca6add0f0eefe459b1cec015aa3.tar.xz
sssd-317d423e76f92ca6add0f0eefe459b1cec015aa3.zip
dlopen-tests: Check the result of asprintf
According to asprintf(3) the content off errmsg is undefined on error, lets set it to NULL.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dlopen-tests.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c
index 67fc41c7a..71b79f9e2 100644
--- a/src/tests/dlopen-tests.c
+++ b/src/tests/dlopen-tests.c
@@ -99,7 +99,8 @@ static bool recursive_dlopen(const char **name, int round, char **errmsg)
handle = dlopen(name[round], RTLD_GLOBAL|RTLD_NOW);
if (!handle) {
- asprintf(errmsg, "dlopen() failed: %s", dlerror());
+ if (asprintf(errmsg, "dlopen() failed: %s", dlerror()) == -1)
+ *errmsg = NULL;
return false;
}