aboutsummaryrefslogtreecommitdiffstats
path: root/memdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'memdup.c')
-rw-r--r--memdup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/memdup.c b/memdup.c
index 9c681e2..a1d0959 100644
--- a/memdup.c
+++ b/memdup.c
@@ -6,7 +6,7 @@
void *
libsimple_memdup(const void *s, size_t n)
{
- void *ret = malloc(n);
+ void *ret = malloc(n ? n : (size_t)1);
if (!ret)
return NULL;
return memcpy(ret, s, n);