diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-25 16:17:12 +0100 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-07-21 15:09:28 +0300 |
commit | bc9d04576065b9bcdb6d1c62b48b37c332b10394 (patch) | |
tree | 4279aacb5db351948b3381e4fe00890231ee9309 | |
parent | 551ad336c1367c64d331e31dd3ea23e17e721b9b (diff) | |
download | spice-bc9d04576065b9bcdb6d1c62b48b37c332b10394.tar.gz spice-bc9d04576065b9bcdb6d1c62b48b37c332b10394.tar.xz spice-bc9d04576065b9bcdb6d1c62b48b37c332b10394.zip |
common: spice_memdup could accept NULL
(this patch is not to solve a crash fix, but to align with glib API)
-rw-r--r-- | common/mem.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |