Bug#440057: memory leaks
Package: apt-transport-https
Version: 0.7.6
In the method "bool HttpsMethod::Fetch(FetchItem *Itm)" there seems to be two
memory leaks.
First you do a new:
// go for it - if the file exists, append on it
File = new FileFd(Itm->DestFile, FileFd::WriteAny);
File->Seek(File->Size());
But later if there is an error, the object 'File' will never be freed:
// cleanup
if(success != 0) {
_error->Error(curl_errorstr);
Fail();
return true;
}
Same thing with object 'headers'.
I suggest the following:
// cleanup
if(success != 0) {
_error->Error(curl_errorstr);
Fail();
File->Close();
Res.Size = 0;
delete File;
curl_slist_free_all(headers);
return true;
}
Or you put the following codeblock into an else branch, so that the existing
cleanup is always used.
Reply to: