get_url_file_name: Fixed crash on OOM on debug build

This caused a null-pointer dereference which caused a few dozen
torture tests to fail.
This commit is contained in:
Dan Fandrich 2014-12-07 11:08:10 +01:00
parent f5e9c636e8
commit e05de4f46d

View File

@ -164,6 +164,8 @@ CURLcode get_url_file_name(char **filename, const char *url)
Curl_safefree(*filename); Curl_safefree(*filename);
*filename = strdup(buffer); /* clone the buffer */ *filename = strdup(buffer); /* clone the buffer */
curl_free(tdir); curl_free(tdir);
if(!*filename)
return CURLE_OUT_OF_MEMORY;
} }
} }
#endif #endif