diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-08-22 22:48:41 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-08-22 22:48:41 +0000 |
commit | 91fd2c3bcdc9f0d336c6d7404279db03ea4eaca9 (patch) | |
tree | 10350efdf90731b134d9ce7caf15bbff90f0900f /lib | |
parent | d38891c9500216c5c69d1d0aa7c725f1de449ddf (diff) |
Bug report #1779751 (http://curl.haxx.se/bug/view.cgi?id=1779751) pointed
out that doing first a file:// upload and then an FTP upload crashed libcurl
or at best caused furious valgrind complaints. Fixed now by making sure we
free and clear the file-specific struct properly when done with it.
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; } |