mirror of
https://github.com/curl/curl.git
synced 2026-06-01 22:14:17 +03:00
fixed minor memory leak when running out of memory
This commit is contained in:
parent
7dfef13224
commit
ccf65be0a4
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue