projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fio: fix smalloc strdop allocation failure
[fio.git]
/
smalloc.c
diff --git
a/smalloc.c
b/smalloc.c
index 67cb7cc11d475b81aef3d53a7eb896eee31504bb..66f9ec0dd5c101dc216956fa74c9f6e959ed9a99 100644
(file)
--- 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 *smalloc_strdup(const char *str)
{
- char *ptr;
+ char *ptr
= NULL
;
ptr = smalloc(strlen(str) + 1);
ptr = smalloc(strlen(str) + 1);
- strcpy(ptr, str);
+ if (ptr)
+ strcpy(ptr, str);
return ptr;
}
return ptr;
}