mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
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.
This commit is contained in:
parent
f087960e99
commit
2dd4abf277
1 changed files with 3 additions and 7 deletions
|
@ -907,13 +907,9 @@ PyObject *PyUnicode_AsUTF8String(PyObject *unicode)
|
||||||
PyErr_BadArgument();
|
PyErr_BadArgument();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
str = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
|
return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
|
||||||
PyUnicode_GET_SIZE(unicode),
|
PyUnicode_GET_SIZE(unicode),
|
||||||
NULL);
|
NULL);
|
||||||
if (str == NULL)
|
|
||||||
return NULL;
|
|
||||||
Py_INCREF(str);
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- UTF-16 Codec ------------------------------------------------------- */
|
/* --- UTF-16 Codec ------------------------------------------------------- */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue