From f1867dcad621ff4280c2710d3941383f382b9529 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 (This used to be commit 9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89) --- source3/lib/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 2f8b52ccbd..ccdfc72bbd 100644 --- a/source3/lib/util.c +++ b/source3/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