From d8ccc87fed8a4c588e4ad9279e62925f416d36b3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 25 Nov 2018 23:05:59 +0100 Subject: Some fixes and add wide-character string duplication functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- memdup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'memdup.c') diff --git a/memdup.c b/memdup.c index a1d0959..5d158b0 100644 --- a/memdup.c +++ b/memdup.c @@ -6,7 +6,7 @@ void * libsimple_memdup(const void *s, size_t n) { - void *ret = malloc(n ? n : (size_t)1); + void *ret = malloc(n + !n); if (!ret) return NULL; return memcpy(ret, s, n); -- cgit v1.2.3-70-g09d2