From 569bbc59e4060160a986d0fea31601a7b7d998fe Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 17 Oct 2013 12:58:40 +0200 Subject: dlopen-tests: Check the 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') 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