diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-06-12 18:56:23 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-06-12 18:56:23 +0200 |
| commit | 395b33f9f8e93223f933c625bacbf1e2d23c6673 (patch) | |
| tree | 08d5853f0add0a0ca0c35db547a18709749172fb /python/depcache.cc | |
| parent | aa31a066174571a64e68c35203f6b2404ef2393f (diff) | |
| download | python-apt-395b33f9f8e93223f933c625bacbf1e2d23c6673.tar.gz | |
Bugfix: Delete pointers correctly, fixing memory leaks. (LP: #370149)
We previously called the destructor of the pointer. This resulted in no
object using pointers being deallocated.
This patch introduces CppDeallocPtr() and CppOwnedDeallocPtr() which do
the same as the other CppDealloc() and CppOwnedDealloc(), but use 'delete'
on the pointer instead of the deconstructor.
Furthermore, this patch also changes AcquireFile to be a CppOwnedPyObject,
owned by the Acquire object. Without this change, deleting the Acquire
object would cause a crash when AcquireFile is deallocated.
Diffstat (limited to 'python/depcache.cc')
| -rw-r--r-- | python/depcache.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/python/depcache.cc b/python/depcache.cc index f1c34fef..9bbda527 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -660,7 +660,7 @@ PyTypeObject PkgDepCacheType = sizeof(CppOwnedPyObject<pkgDepCache *>), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc<pkgDepCache *>, // tp_dealloc + CppOwnedDeallocPtr<pkgDepCache *>, // tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr @@ -844,7 +844,7 @@ PyTypeObject PkgProblemResolverType = sizeof(CppOwnedPyObject<pkgProblemResolver *>), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc<pkgProblemResolver *>, // tp_dealloc + CppOwnedDeallocPtr<pkgProblemResolver *>,// tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr @@ -962,7 +962,7 @@ PyTypeObject PkgActionGroupType = sizeof(CppOwnedPyObject<pkgDepCache::ActionGroup*>), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc<pkgDepCache::ActionGroup*>, // tp_dealloc + CppOwnedDeallocPtr<pkgDepCache::ActionGroup*>, // tp_dealloc 0, // tp_print 0, // tp_getattr 0, // tp_setattr |
