add missing checks on so far ignored return values
[ctdb.git] / lib / util / debug.c
index 341a4a1586ab6534d079abb12e1366dd48ef5be2..9e819292200b374032f89904505efa7fa6622fb7 100644 (file)
@@ -28,8 +28,14 @@ static void _do_debug_v(const char *format, va_list ap)
        char *s = NULL;
        struct tm *tm;
        char tbuf[100];
-
-       vasprintf(&s, format, ap);
+    int ret;
+
+       ret = vasprintf(&s, format, ap);
+       if (ret == -1) {
+               fprintf(stderr, "vasprintf failed in _do_debug_v, cannot print debug message.\n");
+               fflush(stderr);
+               return;
+       }
 
        t = timeval_current();
        tm = localtime(&t.tv_sec);