summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-08-18 06:58:15 (GMT)
committerBarry Warsaw <barry@python.org>2000-08-18 06:58:15 (GMT)
commit2dd4abf27769d6c1c04310d83374f30e229826ea (patch)
tree25233d8f560bc7ae922ab9a20e86fd7e5eb39305 /Objects/unicodeobject.c
parentf087960e9999179c96ffc127b302e81689ac7fc5 (diff)
downloadcpython-2dd4abf27769d6c1c04310d83374f30e229826ea.zip
cpython-2dd4abf27769d6c1c04310d83374f30e229826ea.tar.gz
cpython-2dd4abf27769d6c1c04310d83374f30e229826ea.tar.bz2
PyUnicode_AsUTF8String(): Don't need to explicitly incref str since
PyUnicode_EncodeUTF8() already returns the created object with the proper reference count. This fixes an Insure reported memory leak.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index f4dc9bf..1d35c3d 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -907,13 +907,9 @@ PyObject *PyUnicode_AsUTF8String(PyObject *unicode)
PyErr_BadArgument();
return NULL;
}
- str = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
- PyUnicode_GET_SIZE(unicode),
- NULL);
- if (str == NULL)
- return NULL;
- Py_INCREF(str);
- return str;
+ return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
+ PyUnicode_GET_SIZE(unicode),
+ NULL);
}
/* --- UTF-16 Codec ------------------------------------------------------- */