=== modified file 'cmdline/apt-get.cc'
--- cmdline/apt-get.cc	2009-12-10 20:59:49 +0000
+++ cmdline/apt-get.cc	2010-01-02 10:05:23 +0000
@@ -2163,6 +2163,8 @@
    pkgAcquire Fetcher(&Stat);
 
    DscFile *Dsc = new DscFile[CmdL.FileSize()];
+   if (!Dsc)
+      return false;
    
    // insert all downloaded uris into this set to avoid downloading them
    // twice
@@ -2174,13 +2176,16 @@
       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());
-      
+      }
       // 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();
@@ -2245,6 +2250,7 @@
    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());
@@ -2275,6 +2281,7 @@
    {
       for (unsigned I = 0; I != J; I++)
 	 ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str());
+      delete[] Dsc;
       return true;
    }
    
@@ -2285,12 +2292,15 @@
       for (; I != Fetcher.UriEnd(); I++)
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
+      delete[] Dsc;
       return true;
    }
    
    // Run it
-   if (Fetcher.Run() == pkgAcquire::Failed)
+   if (Fetcher.Run() == pkgAcquire::Failed) {
+      delete[] Dsc;
       return false;
+   }
 
    // Print error messages
    bool Failed = false;
@@ -2304,11 +2314,13 @@
 	      (*I)->ErrorText.c_str());
       Failed = true;
    }
-   if (Failed == true)
+   if (Failed == true) {
+      delete[] Dsc;
       return _error->Error(_("Failed to fetch some archives."));
-   
+   }
    if (_config->FindB("APT::Get::Download-only",false) == true)
    {
+      delete[] Dsc;
       c1out << _("Download complete and in download only mode") << endl;
       return true;
    }
@@ -2371,19 +2383,23 @@
       
       _exit(0);
    }
-   
+
    // Wait for the subprocess
    int Status = 0;
    while (waitpid(Process,&Status,0) != Process)
    {
       if (errno == EINTR)
 	 continue;
+      delete[] Dsc;
       return _error->Errno("waitpid","Couldn't wait for subprocess");
    }
 
-   if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
+   if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0) {
+      delete[] Dsc;
       return _error->Error(_("Child process failed"));
-   
+   }
+
+   delete[] Dsc;
    return true;
 }
 									/*}}}*/

