From: Daniel Stenberg Date: Fri, 17 Dec 2004 09:00:19 +0000 (+0000) Subject: fixed minor memory leak when running out of memory X-Git-Tag: curl-7_12_3~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ccf65be0a463f8813e1bafb5db7c6334a0b08b28;p=thirdparty%2Fcurl.git fixed minor memory leak when running out of memory --- diff --git a/lib/ftp.c b/lib/ftp.c index 65dfa8362b..5016a6a802 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -779,8 +779,10 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status) dlen = strlen(path)-flen; if(dlen) { ftp->prevpath = malloc(dlen + 1); - if(!ftp->prevpath) + if(!ftp->prevpath) { + free(path); return CURLE_OUT_OF_MEMORY; + } memcpy(ftp->prevpath, path, dlen); ftp->prevpath[dlen]=0; /* terminate */ infof(data, "Remembering we are in dir %s\n", ftp->prevpath);