summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-25 16:17:12 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-01-25 16:54:04 +0100
commitc1a567d1942aea3b1cf99432f5b0d5fa99cd5285 (patch)
tree94fc173263e9c1cb618c6d618fb0502e7214462f
parent701efb846d2b8661170fff0d75875c2bcf4adef2 (diff)
common: spice_memdup could accept NULL
-rw-r--r--common/mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/mem.c b/common/mem.c
index b0a7eb1..4db8a2c 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;