]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
compat: fix vsyslog to rely on the result of vasprintf
authorVincent Bernat <vincent@bernat.im>
Wed, 9 Apr 2014 19:03:17 +0000 (21:03 +0200)
committerVincent Bernat <vincent@bernat.im>
Wed, 9 Apr 2014 19:03:17 +0000 (21:03 +0200)
src/compat/vsyslog.c

index 8c0f8f2d08294630d4b8d371d31ff17f8d2df295..be59210a1860aa9b0f9bcdfcc4b18dab49a201a9 100644 (file)
@@ -8,8 +8,9 @@
 void
 vsyslog(int facility, const char *format, va_list ap) {
        char *msg = NULL;
-       vasprintf(&msg, format, ap);
-       if (!msg) return;
+       if (vasprintf(&msg, format, ap) == -1) {
+               return;
+       }
        syslog(facility, "%s", msg);
        free(msg);
 }