From 4f7ea152f1dc8d8d6851dbb14773d019a2f7f44f Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 17 Oct 2013 12:58:40 +0200 Subject: [PATCH] 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(-) diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c index 40e02daa2ea59c76b4ca422552b943e3c5d8f302..dd4cc754ac37621b953a462b5e73696d4556770c 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; } -- 1.8.1.5