From 3a4477a4241bcfbc9db541cf34cc75c1f1111b78 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Mar 2010 11:08:13 +0100 Subject: * cmdline/apt-get.cc - fix memory leaks in error conditions in DoSource() --- apt-pkg/cdrom.cc | 3 ++- cmdline/apt-get.cc | 6 +++++- debian/changelog | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 96d4e9c91..783ffc430 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -289,7 +289,8 @@ bool pkgCdrom::DropRepeats(vector &List,const char *Name) List[J] = string(); } } - + delete[] Inodes; + // Wipe erased entries for (unsigned int I = 0; I < List.size();) { diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index b35e16b92..849401b0c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2299,6 +2299,7 @@ bool DoSource(CommandLine &CmdL) { for (unsigned I = 0; I != J; I++) ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str()); + delete[] Dsc; return true; } @@ -2309,6 +2310,7 @@ bool DoSource(CommandLine &CmdL) for (; I != Fetcher.UriEnd(); I++) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; + delete[] Dsc; return true; } @@ -2334,6 +2336,7 @@ bool DoSource(CommandLine &CmdL) if (_config->FindB("APT::Get::Download-only",false) == true) { c1out << _("Download complete and in download only mode") << endl; + delete[] Dsc; return true; } @@ -2395,7 +2398,8 @@ bool DoSource(CommandLine &CmdL) _exit(0); } - + delete[] Dsc; + // Wait for the subprocess int Status = 0; while (waitpid(Process,&Status,0) != Process) diff --git a/debian/changelog b/debian/changelog index f27c096b6..b05498f12 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,7 @@ apt (0.7.26) UNRELEASED; urgency=low - fix error message construction in OpenLog() * cmdline/apt-get.cc: - add a --only-upgrade flag to install command (Closes: #572259) + - fix memory leaks in error conditions in DoSource() -- David Kalnischkies Fri, 19 Feb 2010 21:21:43 +0100 -- cgit v1.2.3