From: Dan Fandrich Date: Sun, 7 Dec 2014 10:08:10 +0000 (+0100) Subject: get_url_file_name: Fixed crash on OOM on debug build X-Git-Tag: curl-7_40_0~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e05de4f46db67696376f16b1627a2b3701314b20;p=thirdparty%2Fcurl.git 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. --- diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index 7a6ed20156..abf949617f 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -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