[devel] [PATCH for apt 20/38] Get rid of dangling invalid pointer

Aleksei Nikiforov darktemplar на altlinux.org
Вт Дек 10 18:23:25 MSK 2019


Found via clang-static-analyzer
---
 apt/apt-pkg/algorithms.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apt/apt-pkg/algorithms.cc b/apt/apt-pkg/algorithms.cc
index 772f609..2c9208c 100644
--- a/apt/apt-pkg/algorithms.cc
+++ b/apt/apt-pkg/algorithms.cc
@@ -960,6 +960,9 @@ pkgProblemResolver::~pkgProblemResolver()
 {
    delete [] Scores;
    delete [] Flags;
+
+   if (This == this)
+      This = nullptr;
 }
 									/*}}}*/
 // ProblemResolver::ScoreSort - Sort the list by score			/*{{{*/
-- 
2.24.0



Подробная информация о списке рассылки Devel