X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=smalloc.c;h=66f9ec0dd5c101dc216956fa74c9f6e959ed9a99;hb=2894a2d44cfa29c250276853e460b7fb5ea1ef7e;hp=67cb7cc11d475b81aef3d53a7eb896eee31504bb;hpb=f52c9691bc8c285f3445235c69acdfd6de7f9b82;p=fio.git diff --git a/smalloc.c b/smalloc.c index 67cb7cc1..66f9ec0d 100644 --- a/smalloc.c +++ b/smalloc.c @@ -492,9 +492,10 @@ void *scalloc(size_t nmemb, size_t size) char *smalloc_strdup(const char *str) { - char *ptr; + char *ptr = NULL; ptr = smalloc(strlen(str) + 1); - strcpy(ptr, str); + if (ptr) + strcpy(ptr, str); return ptr; }