diff options
| author | Julian Andres Klode <jak@debian.org> | 2026-01-31 22:41:04 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-02-10 19:59:03 +0000 |
| commit | e7c1adda00abd16285f5eb53c48587855f2a2992 (patch) | |
| tree | 269e8817f6ca504d36865e44ab01646c19e8e2bb | |
| parent | 7d84e1f830727ca5008566113e7dfd35df049bd6 (diff) | |
solver3: Avoid manual delete[] in favor of RAII
| -rw-r--r-- | apt-pkg/solver3.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 2727c3a1d..326e43529 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -1053,9 +1053,9 @@ Clause DependencySolver::TranslateOrGroup(pkgCache::DepIterator start, pkgCache: } else { - auto all = start.AllTargets(); + std::unique_ptr<pkgCache::Version *[]> all(start.AllTargets()); - for (auto tgt = all; *tgt; ++tgt) + for (auto tgt = all.get(); *tgt; ++tgt) { pkgCache::VerIterator tgti(cache, *tgt); @@ -1063,7 +1063,6 @@ Clause DependencySolver::TranslateOrGroup(pkgCache::DepIterator start, pkgCache: std::cerr << "Adding work to item " << reason.toString(cache) << " -> " << tgti.ParentPkg().FullName() << "=" << tgti.VerStr() << (clause.negative ? " (negative)" : "") << "\n"; clause.solutions.push_back(Var(pkgCache::VerIterator(cache, *tgt))); } - delete[] all; std::stable_sort(clause.solutions.begin() + begin, clause.solutions.end(), CompareProviders3{cache, policy, start.TargetPkg(), *this}); } if (start == end) |
