]> granicus.if.org Git - curl/commitdiff
better bailing out in case of no memory
authorDaniel Stenberg <daniel@haxx.se>
Thu, 13 May 2004 15:17:07 +0000 (15:17 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 13 May 2004 15:17:07 +0000 (15:17 +0000)
lib/file.c

index 0edd3d972f76ff08685b60f3f3f02c378361a129..05a1fde58cd105793b660b3accf331da7d266729 100644 (file)
@@ -107,9 +107,14 @@ CURLcode Curl_file_connect(struct connectdata *conn)
   char *actual_path;
 #endif
 
+  if(!real_path)
+    return CURLE_OUT_OF_MEMORY;
+
   file = (struct FILEPROTO *)calloc(sizeof(struct FILEPROTO), 1);
-  if(!file)
+  if(!file) {
+    free(real_path);
     return CURLE_OUT_OF_MEMORY;
+  }
 
   conn->proto.file = file;