1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

fixed minor memory leak when running out of memory

This commit is contained in:
Daniel Stenberg 2004-12-17 09:00:19 +00:00
parent 7dfef13224
commit ccf65be0a4

View File

@ -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);