add missing "free(buffer) for allocated buffer
[apt.git] / cmdline / apt-get.cc
index 64b062ea4ef16c86d8e48ca26ad486ac9a869a79..73b396795b9f84187c486d99a9f8f3931ed6ed4b 100644 (file)
@@ -1912,7 +1912,6 @@ bool DoInstall(CommandLine &CmdL)
       return false;
    }
 
-   unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 };
 
   TryToInstall InstallAction(Cache, Fix, BrokenFix);
   TryToRemove RemoveAction(Cache, Fix);
@@ -1920,6 +1919,7 @@ bool DoInstall(CommandLine &CmdL)
    // new scope for the ActionGroup
    {
       pkgDepCache::ActionGroup group(Cache);
+      unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 };
 
       for (unsigned short i = 0; order[i] != 0; ++i)
       {
@@ -1962,7 +1962,6 @@ bool DoInstall(CommandLine &CmdL)
       if (Fix != NULL)
       {
         // Call the scored problem resolver
-        Fix->InstallProtect();
         Fix->Resolve(true);
         delete Fix;
       }
@@ -2023,7 +2022,7 @@ bool DoInstall(CommandLine &CmdL)
 
    /* Print out a list of suggested and recommended packages */
    {
-      string SuggestsList, RecommendsList, List;
+      string SuggestsList, RecommendsList;
       string SuggestsVersions, RecommendsVersions;
       for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
       {
@@ -2291,9 +2290,10 @@ bool DoClean(CommandLine &CmdL)
    FileFd Lock;
    if (_config->FindB("Debug::NoLocking",false) == false)
    {
-      Lock.Fd(GetLock(archivedir + "lock"));
-      if (_error->PendingError() == true)
+      int lock_fd = GetLock(archivedir + "lock");
+      if (lock_fd < 0)
         return _error->Error(_("Unable to lock the download directory"));
+      Lock.Fd(lock_fd);
    }
    
    pkgAcquire Fetcher;
@@ -2327,9 +2327,10 @@ bool DoAutoClean(CommandLine &CmdL)
    FileFd Lock;
    if (_config->FindB("Debug::NoLocking",false) == false)
    {
-      Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
-      if (_error->PendingError() == true)
+      int lock_fd = GetLock(_config->FindDir("Dir::Cache::Archives") + "lock");
+      if (lock_fd < 0)
         return _error->Error(_("Unable to lock the download directory"));
+      Lock.Fd(lock_fd);
    }
    
    CacheFile Cache;
@@ -3123,8 +3124,7 @@ bool DoBuildDep(CommandLine &CmdL)
             }
         }             
       }
-      
-      Fix.InstallProtect();
+
       if (Fix.Resolve(true) == false)
         _error->Discard();