From 4f7ea152f1dc8d8d6851dbb14773d019a2f7f44f Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 17 Oct 2013 12:58:40 +0200 Subject: dlopen-tests: Check result of asprintf According to asprintf(3) the content off errmsg is undefined on error, lets set it to NULL. --- src/tests/dlopen-tests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c index 40e02daa..dd4cc754 100644 --- a/src/tests/dlopen-tests.c +++ b/src/tests/dlopen-tests.c @@ -102,7 +102,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; } -- cgit