summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJonathan Thomas <echidnaman@gmail.com>2012-11-10 14:25:45 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-11-10 14:25:45 +0100
commit0291f6459b0a8de04268225cc0c88d340ba48653 (patch)
treecbac4f8cf6bfdaa4074aec24ba234ffa7e42304b /apt-pkg
parentb83cad32f1d67fef2dbb12476ed9d3ad8f353db6 (diff)
downloadapt-0291f6459b0a8de04268225cc0c88d340ba48653.tar.gz
* apt-pkg/algorithms.cc:
- fix package-pointer array memory leak in ResolveByKeepInternal()
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index b611df172..8cd9d4c6e 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1419,12 +1419,18 @@ bool pkgProblemResolver::ResolveByKeepInternal()
continue;
// Restart again.
- if (K == LastStop)
- return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false).c_str());
+ if (K == LastStop) {
+ // I is an iterator based off our temporary package list,
+ // so copy the name we need before deleting the temporary list
+ std::string const LoopingPackage = I.FullName(false);
+ delete[] PList;
+ return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.", LoopingPackage.c_str());
+ }
LastStop = K;
K = PList - 1;
- }
+ }
+ delete[] PList;
return true;
}
/*}}}*/