diff options
Diffstat (limited to 'smalloc.c')
-rw-r--r-- | smalloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } |