summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-07-20 22:09:10 +0200
committerJulian Andres Klode <jak@debian.org>2017-07-20 22:09:10 +0200
commit414b7d57eda362328568484957fbd6c06b1b0d1f (patch)
treed268683acd57d02c34a60cee31c5a31ad43fac14 /apt-pkg
parentb28636e54f682dc65aef169f201a34a8e2893369 (diff)
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
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/error.cc4
1 files changed, 2 insertions, 2 deletions
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 /*{{{*/