diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-10-09 16:37:11 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-10-09 16:37:11 +0200 |
commit | 199b3e46f9b9b62238388bb49bdd83303d26437f (patch) | |
tree | 8d23ef8c736e26b066a9d4c64bbf9d0ffb307548 /src/tool_operhlp.c | |
parent | 558814e16d84aa202c5ccc0c8108a9d728e77a58 (diff) | |
download | curl-199b3e46f9b9b62238388bb49bdd83303d26437f.tar.gz |
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
Diffstat (limited to 'src/tool_operhlp.c')
-rw-r--r-- | src/tool_operhlp.c | 8 |
1 files changed, 3 insertions, 5 deletions
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 |