0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.3.1162

Problem:    Python: Memory leaks
Solution:   Add more Py_DECREF(). (ZyX)
This commit is contained in:
Bram Moolenaar
2013-06-10 20:47:36 +02:00
parent c1ba10c7f6
commit f9c9b32bd1
3 changed files with 21 additions and 14 deletions

View File

@@ -5354,6 +5354,7 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
{
int i;
PyObject *other_module;
PyObject *attr;
for (i = 0; i < (int)(sizeof(numeric_constants)
/ sizeof(struct numeric_constant));
@@ -5392,14 +5393,26 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr)
if (!(py_chdir = PyObject_GetAttrString(other_module, "chdir")))
return -1;
ADD_OBJECT(m, "_chdir", py_chdir);
if (PyObject_SetAttrString(other_module, "chdir", get_attr(m, "chdir")))
if (!(attr = get_attr(m, "chdir")))
return -1;
if (PyObject_SetAttrString(other_module, "chdir", attr))
{
Py_DECREF(attr);
return -1;
}
Py_DECREF(attr);
if ((py_fchdir = PyObject_GetAttrString(other_module, "fchdir")))
{
ADD_OBJECT(m, "_fchdir", py_fchdir);
if (PyObject_SetAttrString(other_module,"fchdir",get_attr(m,"fchdir")))
if (!(attr = get_attr(m, "fchdir")))
return -1;
if (PyObject_SetAttrString(other_module, "fchdir", attr))
{
Py_DECREF(attr);
return -1;
}
Py_DECREF(attr);
}
else
PyErr_Clear();