mirror of
https://github.com/samba-team/samba.git
synced 2025-12-18 08:23:51 +03:00
return NULL for a zero size memdup
This commit is contained in:
@@ -2581,6 +2581,7 @@ like strdup but for memory
|
|||||||
void *memdup(void *p, size_t size)
|
void *memdup(void *p, size_t size)
|
||||||
{
|
{
|
||||||
void *p2;
|
void *p2;
|
||||||
|
if (size == 0) return NULL;
|
||||||
p2 = malloc(size);
|
p2 = malloc(size);
|
||||||
if (!p2) return NULL;
|
if (!p2) return NULL;
|
||||||
memcpy(p2, p, size);
|
memcpy(p2, p, size);
|
||||||
|
|||||||
Reference in New Issue
Block a user