about summary refs log tree commit diff
path: root/lib/util/vasprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/vasprintf.c')
-rw-r--r--lib/util/vasprintf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/util/vasprintf.c b/lib/util/vasprintf.c
index 6d350f88..47b4079d 100644
--- a/lib/util/vasprintf.c
+++ b/lib/util/vasprintf.c
@@ -18,9 +18,11 @@ vasprintfN(const char ** const resultP,
     char * result;
 
 #if HAVE_VASPRINTF
-    vasprintf(&result, format, varargs);
+    int rc;
 
-    if (result == NULL)
+    rc = vasprintf(&result, format, varargs);
+
+    if (rc < 0)
         *resultP = strsol;
     else
         *resultP = result;