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
This commit is contained in:
Daniel Stenberg 2014-10-09 16:37:11 +02:00
parent 558814e16d
commit 199b3e46f9
1 changed files with 3 additions and 5 deletions

View File

@ -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