summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-12-07 15:05:07 +0100
committerJulian Andres Klode <jak@debian.org>2010-12-07 15:05:07 +0100
commita691dfaeed95528206863db49f00980413913afc (patch)
tree0d9a34a12d4689d8c09a82e610a79c58c007b9f2
parent0454e03e4c58d4ff63538badbf1b17276fe31494 (diff)
downloadpython-apt-a691dfaeed95528206863db49f00980413913afc.tar.gz
python/generic.h: Fix a memory leak (leaking on every unicode string).
-rw-r--r--debian/changelog6
-rw-r--r--python/generic.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 2241ee5d..662d61e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-apt (0.7.100.1) UNRELEASED; urgency=low
+
+ * python/generic.h: Fix a memory leak (leaking on every unicode string).
+
+ -- Julian Andres Klode <jak@debian.org> Tue, 07 Dec 2010 15:01:08 +0100
+
python-apt (0.7.100) unstable; urgency=low
* Final 0.7.100 release; targeted at Squeeze.
diff --git a/python/generic.h b/python/generic.h
index 31c1bc2d..fc2a6c06 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -79,7 +79,9 @@ typedef int Py_ssize_t;
static inline const char *PyUnicode_AsString(PyObject *op) {
// Convert to bytes object, using the default encoding.
- PyObject *bytes = PyUnicode_AsEncodedString(op,0,0);
+ // Use Python-internal API, there is no other way to do this
+ // without a memory leak.
+ PyObject *bytes = _PyUnicode_AsDefaultEncodedString(op, 0);
return bytes ? PyBytes_AS_STRING(bytes) : 0;
}