common: spice_memdup could accept NULL

(this patch is not to solve a crash fix, but to align with glib API)
This commit is contained in:
Marc-André Lureau 2011-01-25 16:17:12 +01:00
parent 27f771566d
commit fc80f096e4

View File

@ -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;