Commit 5b93dfe0 authored by Christian Heimes's avatar Christian Heimes

Issue #15900: Fixed reference leak in PyUnicode_TranslateCharmap()

parent d816d94e
...@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Release Candidate 3? ...@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Release Candidate 3?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #15900: Fixed reference leak in PyUnicode_TranslateCharmap().
- Issue #15926: Fix crash after multiple reinitializations of the interpreter. - Issue #15926: Fix crash after multiple reinitializations of the interpreter.
- Issue #15895: Fix FILE pointer leak in one error branch of - Issue #15895: Fix FILE pointer leak in one error branch of
......
...@@ -8585,10 +8585,13 @@ PyUnicode_TranslateCharmap(const Py_UNICODE *p, ...@@ -8585,10 +8585,13 @@ PyUnicode_TranslateCharmap(const Py_UNICODE *p,
PyObject *mapping, PyObject *mapping,
const char *errors) const char *errors)
{ {
PyObject *result;
PyObject *unicode = PyUnicode_FromUnicode(p, size); PyObject *unicode = PyUnicode_FromUnicode(p, size);
if (!unicode) if (!unicode)
return NULL; return NULL;
return _PyUnicode_TranslateCharmap(unicode, mapping, errors); result = _PyUnicode_TranslateCharmap(unicode, mapping, errors);
Py_DECREF(unicode);
return result;
} }
PyObject * PyObject *
...@@ -8600,14 +8603,10 @@ PyUnicode_Translate(PyObject *str, ...@@ -8600,14 +8603,10 @@ PyUnicode_Translate(PyObject *str,
str = PyUnicode_FromObject(str); str = PyUnicode_FromObject(str);
if (str == NULL) if (str == NULL)
goto onError; return NULL;
result = _PyUnicode_TranslateCharmap(str, mapping, errors); result = _PyUnicode_TranslateCharmap(str, mapping, errors);
Py_DECREF(str); Py_DECREF(str);
return result; return result;
onError:
Py_XDECREF(str);
return NULL;
} }
static Py_UCS4 static Py_UCS4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment