From: Daniel Stenberg Date: Thu, 9 Oct 2014 14:37:11 +0000 (+0200) Subject: get_url_file_name: never return a NULL string *and* OK X-Git-Tag: curl-7_39_0~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=199b3e46f9b9b62238388bb49bdd83303d26437f;p=curl get_url_file_name: never return a NULL string *and* OK Change 987a4a73 assumes that as it simplifies life in the calling function. Reported-by: Fabian Keil --- diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index 15eefabe7..4a13cf186 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -143,11 +143,9 @@ CURLcode get_url_file_name(char **filename, const char *url) if(pc) { /* duplicate the string beyond the slash */ pc++; - if(*pc) { - *filename = strdup(pc); - if(!*filename) - return CURLE_OUT_OF_MEMORY; - } + *filename = strdup(pc); + if(!*filename) + return CURLE_OUT_OF_MEMORY; } /* in case we built debug enabled, we allow an environment variable