Stricter strdup.

This commit is contained in:
Hisham 2016-05-30 12:22:22 -03:00
parent 7ededce9b5
commit 4674b4a732
1 changed files with 4 additions and 1 deletions

View File

@ -44,8 +44,11 @@ void* xRealloc(void* ptr, size_t size) {
} }
char* xStrdup(const char* str) { char* xStrdup(const char* str) {
if (!str) {
fail();
}
char* data = strdup(str); char* data = strdup(str);
if (!data && str) { if (!data) {
fail(); fail();
} }
return data; return data;