From 54cd2bee581ac5f544443d66c9951d1b88d7a583 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 13 May 2004 15:17:07 +0000 Subject: [PATCH] better bailing out in case of no memory --- lib/file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/file.c b/lib/file.c index 0edd3d972..05a1fde58 100644 --- a/lib/file.c +++ b/lib/file.c @@ -107,10 +107,15 @@ CURLcode Curl_file_connect(struct connectdata *conn) char *actual_path; #endif - file = (struct FILEPROTO *)calloc(sizeof(struct FILEPROTO), 1); - if(!file) + if(!real_path) return CURLE_OUT_OF_MEMORY; + file = (struct FILEPROTO *)calloc(sizeof(struct FILEPROTO), 1); + if(!file) { + free(real_path); + return CURLE_OUT_OF_MEMORY; + } + conn->proto.file = file; #if defined(WIN32) || defined(__EMX__)