chiark / gitweb /
bus: make sure we don't try to malloc 0 bytes
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Oct 2013 21:40:34 +0000 (17:40 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Oct 2013 21:56:55 +0000 (17:56 -0400)
src/libsystemd-bus/bus-message.c

index bc67c32..3f68435 100644 (file)
@@ -1284,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;