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
1 changed files with 2 additions and 0 deletions

View File

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