]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/alloc-util.c
tree-wide: make new/new0/malloc_multiply/reallocarray safe for size 0
[thirdparty/systemd.git] / src / basic / alloc-util.c
index 405445eac1fe3faed2676978cc460f2ccf54ef4c..ab7a42c4e20116a9cff540bb1e559943546cf796 100644 (file)
@@ -12,7 +12,7 @@ void* memdup(const void *p, size_t l) {
 
         assert(l == 0 || p);
 
-        ret = malloc(l);
+        ret = malloc(l ?: 1);
         if (!ret)
                 return NULL;