summaryrefslogtreecommitdiff
path: root/python/acquire.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-14 18:43:50 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-14 18:43:50 +0200
commit6b9a8176d06bbe0e00b9c0d37b33c7a4e6fe4054 (patch)
tree6e9d4d29cdc6ebd252a6706e30619bbcc0a1129f /python/acquire.cc
parent0f753709899127e0bbdc6bfcabfc84b0ba5cd3c2 (diff)
downloadpython-apt-6b9a8176d06bbe0e00b9c0d37b33c7a4e6fe4054.tar.gz
python/acquire.cc: Check that an owner exists in AcquireItemDealloc.
Diffstat (limited to 'python/acquire.cc')
-rw-r--r--python/acquire.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/acquire.cc b/python/acquire.cc
index 8b6de173..9104644d 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -112,6 +112,12 @@ static PyObject *AcquireItemRepr(PyObject *Self)
static void AcquireItemDealloc(PyObject *self) {
pkgAcquire::Item *file = GetCpp<pkgAcquire::Item*>(self);
PyAcquireObject *owner = (PyAcquireObject *)GetOwner<pkgAcquire::Item*>(self);
+
+ // Simply deallocate the object if we have no owner.
+ if (owner == NULL) {
+ CppOwnedDeallocPtr<pkgAcquire::Item*>(self);
+ return;
+ }
vector<PyAcquireItemObject *> &items = owner->items;
bool DeletePtr = !((CppPyObject<pkgAcquire::Item*> *)self)->NoDelete;