]> granicus.if.org Git - python/commitdiff
Fix refleak in __import__("") (probably the cause of the 2 refleaks in
authorThomas Wouters <thomas@python.org>
Wed, 5 Apr 2006 13:39:37 +0000 (13:39 +0000)
committerThomas Wouters <thomas@python.org>
Wed, 5 Apr 2006 13:39:37 +0000 (13:39 +0000)
test_builtin.)

Python/import.c

index 6a47d957245e8a6801cb01806d163cda0283b5f8..c3bd275104d8537d8d3d95ff1d4cb0fb3358c43b 100644 (file)
@@ -1938,6 +1938,8 @@ import_module_level(char *name, PyObject *globals, PyObject *locals,
                /* If tail is Py_None, both get_parent and load_next found
                   an empty module name: someone called __import__("") or
                   doctored faulty bytecode */
+               Py_DECREF(tail);
+               Py_DECREF(head);
                PyErr_SetString(PyExc_ValueError,
                                "Empty module name");
                return NULL;