From 414b7d57eda362328568484957fbd6c06b1b0d1f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 20 Jul 2017 22:09:10 +0200 Subject: Fix memory leak in C++-thread-local _error implementation We can't allocate a pointer here, it would not get released - use an object instead. Gbp-Dch: ignore --- apt-pkg/contrib/error.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib/error.cc') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index e036f9aed..3c397eaf8 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -34,8 +34,8 @@ // Global Error Object /*{{{*/ GlobalError *_GetErrorObj() { - static thread_local GlobalError *Obj = new GlobalError; - return Obj; + static thread_local GlobalError Obj; + return &Obj; } /*}}}*/ // GlobalError::GlobalError - Constructor /*{{{*/ -- cgit v1.2.3