From bc9d04576065b9bcdb6d1c62b48b37c332b10394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 25 Jan 2011 16:17:12 +0100 Subject: [PATCH] common: spice_memdup could accept NULL (this patch is not to solve a crash fix, but to align with glib API) --- common/mem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/mem.c b/common/mem.c index a9bd6cc2..db22d392 100644 --- a/common/mem.c +++ b/common/mem.c @@ -71,6 +71,10 @@ void *spice_memdup(const void *mem, size_t n_bytes) { void *copy; + if (mem == NULL) { + return NULL; + } + copy = spice_malloc(n_bytes); memcpy(copy, mem, n_bytes); return copy;