summaryrefslogtreecommitdiffstats
path: root/src/if_py_both.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-10 20:47:36 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-10 20:47:36 +0200
commitf9c9b32bd124235136980749bee754cae99e164a (patch)
treec10aac1a4002c1bccedd888418f577d23c33c19c /src/if_py_both.h
parentc1ba10c7f63d65cb7ec3eb11932feb0ee636a033 (diff)
updated for version 7.3.1162v7.3.1162
Problem: Python: Memory leaks Solution: Add more Py_DECREF(). (ZyX)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index be75cc8433..287191a4ea 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -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();