]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
Fix double free (closes: #711045)
[apt.git] / apt-pkg / algorithms.cc
index 7fcd9f0db48da4fac460d271659e3524910b11b6..6cde4d6cc1ddcc5a8ae0da730db74f270c513789 100644 (file)
@@ -648,7 +648,10 @@ void pkgProblemResolver::MakeScores()
              D->Type != pkgCache::Dep::Recommends))
            continue;    
         
-        Scores[I->ID] += abs(OldScores[D.ParentPkg()->ID]);
+        // Do not propagate negative scores otherwise
+        // an extra (-2) package might score better than an optional (-1)
+        if (OldScores[D.ParentPkg()->ID] > 0)
+            Scores[I->ID] += OldScores[D.ParentPkg()->ID];
       }      
    }