summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-04-16 01:10:09 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-04-16 01:10:09 +0200
commit6070a3461841d4398d731fcb33792d55779111f1 (patch)
tree2b7217a5d542202040e8abdcf2eb5d52a32efd90 /cmdline/apt-get.cc
parent949e033cb7c741b9eed459c0e93a89a92acb168d (diff)
fix a bunch of cppcheck warnings/errors based on a patch by
Niels Thykier, thanks! (Closes: #622805)
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index e2d9bb7d4..38003e430 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -2386,8 +2386,10 @@ bool DoSource(CommandLine &CmdL)
string Src;
pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache);
- if (Last == 0)
+ if (Last == 0) {
+ delete[] Dsc;
return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
+ }
string srec = Last->AsStr();
string::size_type pos = srec.find("\nVcs-");
@@ -2418,8 +2420,10 @@ bool DoSource(CommandLine &CmdL)
// Back track
vector<pkgSrcRecords::File> Lst;
- if (Last->Files(Lst) == false)
+ if (Last->Files(Lst) == false) {
+ delete[] Dsc;
return false;
+ }
// Load them into the fetcher
for (vector<pkgSrcRecords::File>::const_iterator I = Lst.begin();
@@ -2480,6 +2484,7 @@ bool DoSource(CommandLine &CmdL)
struct statvfs Buf;
string OutputDir = ".";
if (statvfs(OutputDir.c_str(),&Buf) != 0) {
+ delete[] Dsc;
if (errno == EOVERFLOW)
return _error->WarningE("statvfs",_("Couldn't determine free space in %s"),
OutputDir.c_str());
@@ -2493,10 +2498,12 @@ bool DoSource(CommandLine &CmdL)
#if HAVE_STRUCT_STATFS_F_TYPE
|| unsigned(Stat.f_type) != RAMFS_MAGIC
#endif
- )
+ ) {
+ delete[] Dsc;
return _error->Error(_("You don't have enough free space in %s"),
OutputDir.c_str());
- }
+ }
+ }
// Number of bytes
if (DebBytes != FetchBytes)
@@ -2531,7 +2538,10 @@ bool DoSource(CommandLine &CmdL)
// Run it
if (Fetcher.Run() == pkgAcquire::Failed)
+ {
+ delete[] Dsc;
return false;
+ }
// Print error messages
bool Failed = false;
@@ -2546,8 +2556,11 @@ bool DoSource(CommandLine &CmdL)
Failed = true;
}
if (Failed == true)
+ {
+ delete[] Dsc;
return _error->Error(_("Failed to fetch some archives."));
-
+ }
+
if (_config->FindB("APT::Get::Download-only",false) == true)
{
c1out << _("Download complete and in download only mode") << endl;