[Spice-devel] [PATCH 6/9] common: spice_memdup could accept NULL
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Jan 25 10:17:25 PST 2011
---
common/mem.c | 4 ++++
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;
--
1.7.3.4
More information about the Spice-devel
mailing list