chiark / gitweb /
bus: make sure we don't try to malloc 0 bytes
[elogind.git] / src / libsystemd-bus / bus-message.c
index bc67c323808a6930729e4a5ff512793893bf6687..3f68435d21b9e72065e396f57166510d9864b713 100644 (file)
@@ -1284,7 +1284,7 @@ static int part_make_space(
 
                 part->munmap_this = true;
         } else {
 
                 part->munmap_this = true;
         } else {
-                n = realloc(part->data, sz);
+                n = realloc(part->data, MAX(sz, 1u));
                 if (!n) {
                         m->poisoned = true;
                         return -ENOMEM;
                 if (!n) {
                         m->poisoned = true;
                         return -ENOMEM;