diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/file.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/file.c b/lib/file.c index 8562cc21b..1abc838ea 100644 --- a/lib/file.c +++ b/lib/file.c @@ -96,7 +96,8 @@ */ CURLcode Curl_file_connect(struct connectdata *conn) { - char *real_path = curl_easy_unescape(conn->data, conn->data->reqdata.path, 0, NULL); + char *real_path = curl_easy_unescape(conn->data, conn->data->reqdata.path, 0, + NULL); struct FILEPROTO *file; int fd; #if defined(WIN32) || defined(MSDOS) || defined(__EMX__) @@ -113,9 +114,8 @@ CURLcode Curl_file_connect(struct connectdata *conn) return CURLE_OUT_OF_MEMORY; } - if (conn->data->reqdata.proto.file) { + if (conn->data->reqdata.proto.file) free(conn->data->reqdata.proto.file); - } conn->data->reqdata.proto.file = file; @@ -177,6 +177,9 @@ CURLcode Curl_file_done(struct connectdata *conn, if(file->fd != -1) close(file->fd); + free(file); + conn->data->reqdata.proto.file= NULL; /* clear it! */ + return CURLE_OK; } |