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 committed by Alon Levy
parent 551ad336c1
commit bc9d045760

View File

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