]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cache.cc
fix memory leaks reported by -fsanitize
[apt.git] / cmdline / apt-cache.cc
index 3b8ebc96d0b2a2fd2a6f6b453a5c70e1d8b3e41d..9c884433c8be4c19e7c96337d0c55eb21256becd 100644 (file)
@@ -1484,6 +1484,7 @@ static bool Search(CommandLine &CmdL)
    delete [] PatternMatch;
    for (unsigned I = 0; I != NumPatterns; I++)
       regfree(&Patterns[I]);
+   delete [] Patterns;
    if (ferror(stdout))
        return _error->Error("Write to stdout failed");
    return true;
@@ -1638,6 +1639,8 @@ static bool Policy(CommandLine &CmdL)
       cout << _("Package files:") << endl;   
       for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
       {
+        if (F.Flagged(pkgCache::Flag::NoPackages))
+           continue;
         // Locate the associated index files so we can derive a description
         pkgIndexFile *Indx;
         if (SrcList->FindIndex(F,Indx) == false &&
@@ -1726,7 +1729,7 @@ static bool Policy(CommandLine &CmdL)
            cout << " *** " << V.VerStr();
         else
            cout << "     " << V.VerStr();
-        cout << " " << Plcy->GetPriority(Pkg) << endl;
+        cout << " " << Plcy->GetPriority(V) << endl;
         for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
         {
            // Locate the associated index files so we can derive a description