chiark / gitweb /
bus: make sure we don't try to malloc 0 bytes
[elogind.git] / src / libsystemd-bus / bus-message.c
index 18c2d1c19dc75437fe9865c5cf4dd0d712b6fdc2..3f68435d21b9e72065e396f57166510d9864b713 100644 (file)
@@ -639,7 +639,6 @@ int sd_bus_message_new_method_errorf(
                 const char *format,
                 ...) {
 
-        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         sd_bus_message *t;
         va_list ap;
         int r;
@@ -1285,7 +1284,7 @@ static int part_make_space(
 
                 part->munmap_this = true;
         } else {
-                n = realloc(part->data, sz);
+                n = realloc(part->data, MAX(sz, 1u));
                 if (!n) {
                         m->poisoned = true;
                         return -ENOMEM;