summaryrefslogtreecommitdiffstats
path: root/source/lib/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-22 08:29:41 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-22 08:29:41 +0000
commit9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89 (patch)
treef2a6bcccd29bab3bc0770a3d9794b04bd719469f /source/lib/util.c
parentd0fc1675df35e65488a19d7f5929792fba347b07 (diff)
downloadsamba-9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89.tar.gz
samba-9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89.tar.xz
samba-9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89.zip
return NULL for a zero size memdup
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c1
1 files changed, 1 insertions, 0 deletions
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);