summaryrefslogtreecommitdiffstats
path: root/common
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-05-03 16:49:56 +0200
commitfc80f096e4b0432f873807c6d5d7a66ebb345323 (patch)
tree8bfb12acb1489b805e1190bb81458074ad6c6087 /common
parent27f771566d2fb76f62010acb6967a28e9045c43c (diff)
downloadspice-fc80f096e4b0432f873807c6d5d7a66ebb345323.tar.gz
spice-fc80f096e4b0432f873807c6d5d7a66ebb345323.tar.xz
spice-fc80f096e4b0432f873807c6d5d7a66ebb345323.zip
common: spice_memdup could accept NULL
(this patch is not to solve a crash fix, but to align with glib API)
Diffstat (limited to 'common')
-rw-r--r--common/mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/mem.c b/common/mem.c
index 96be351c..7236cf0c 100644
--- a/common/mem.c
+++ b/common/mem.c
@@ -74,6 +74,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;