]> granicus.if.org Git - curl/commitdiff
get_url_file_name: never return a NULL string *and* OK
authorDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2014 14:37:11 +0000 (16:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2014 14:37:11 +0000 (16:37 +0200)
Change 987a4a73 assumes that as it simplifies life in the calling
function.

Reported-by: Fabian Keil
src/tool_operhlp.c

index 15eefabe7d83766ed3d527a19d467941350eaf64..4a13cf18656f841e90ff0d0814f59d764d3145dd 100644 (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