From: Antoine Pitrou Date: Mon, 16 Apr 2012 20:06:21 +0000 (+0200) Subject: Fix another refleak X-Git-Tag: v3.3.0a3~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22a1d17bb5202337f75f684492ffbe57db84fdd3;p=thirdparty%2FPython%2Fcpython.git Fix another refleak --- diff --git a/Python/import.c b/Python/import.c index a71bc3756d85..1b232fc87415 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);