diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-16 20:06:21 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-16 20:06:21 (GMT) |
commit | 22a1d17bb5202337f75f684492ffbe57db84fdd3 (patch) | |
tree | 7aae9946c19377a7e6c60012e36bb7bada51bed0 /Python/import.c | |
parent | 538ba2afb56414f96ad876d4fae0ae25c0019df8 (diff) | |
download | cpython-22a1d17bb5202337f75f684492ffbe57db84fdd3.zip cpython-22a1d17bb5202337f75f684492ffbe57db84fdd3.tar.gz cpython-22a1d17bb5202337f75f684492ffbe57db84fdd3.tar.bz2 |
Fix another refleak
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/import.c b/Python/import.c index a71bc37..1b232fc 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2881,11 +2881,15 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals, Py_INCREF(final_mod); } else { - Py_ssize_t cut_off = PyUnicode_GetLength(name) - - PyUnicode_GetLength(front); - Py_ssize_t abs_name_len = PyUnicode_GetLength(abs_name); + Py_ssize_t cut_off = PyUnicode_GET_LENGTH(name) - + PyUnicode_GET_LENGTH(front); + Py_ssize_t abs_name_len = PyUnicode_GET_LENGTH(abs_name); PyObject *to_return = PyUnicode_Substring(abs_name, 0, abs_name_len - cut_off); + Py_DECREF(front); + if (to_return == NULL) { + goto error_with_unlock; + } final_mod = PyDict_GetItem(interp->modules, to_return); Py_DECREF(to_return); |