From 9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Apr 2000 08:29:41 +0000 Subject: return NULL for a zero size memdup --- source/lib/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/lib/util.c') diff --git a/source/lib/util.c b/source/lib/util.c index 2f8b52ccbde..ccdfc72bbdd 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -2581,6 +2581,7 @@ like strdup but for memory void *memdup(void *p, size_t size) { void *p2; + if (size == 0) return NULL; p2 = malloc(size); if (!p2) return NULL; memcpy(p2, p, size); -- cgit