diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 1 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 9 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_library_load.c | 9 |
4 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 7f13a7a4d94..8b741eba18a 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -748,6 +748,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...) /* set the value so we can access it */ PyDict_SetItemString(py_dict, "values", values); + Py_DECREF(values); py_result = PyRun_File(fp, filepath, Py_file_input, py_dict, py_dict); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 17617a231b2..93c97d48bac 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -356,10 +356,10 @@ static PyGetSetDef bpy_app_getsets[] = { static void py_struct_seq_getset_init(void) { /* tricky dynamic members, not to py-spec! */ - PyGetSetDef *getset; - - for (getset = bpy_app_getsets; getset->name; getset++) { - PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, PyDescr_NewGetSet(&BlenderAppType, getset)); + for (PyGetSetDef *getset = bpy_app_getsets; getset->name; getset++) { + PyObject *item = PyDescr_NewGetSet(&BlenderAppType, getset); + PyDict_SetItemString(BlenderAppType.tp_dict, getset->name, item); + Py_DECREF(item); } } /* end dynamic bpy.app */ diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 9b477e384db..65b6bd501ce 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -110,9 +110,11 @@ static void bpy_pydriver_update_dict(const float evaltime) bpy_pydriver_InternStr__frame = PyUnicode_FromString("frame"); } + PyObject *item = PyFloat_FromDouble(evaltime); PyDict_SetItem(bpy_pydriver_Dict, bpy_pydriver_InternStr__frame, - PyFloat_FromDouble(evaltime)); + item); + Py_DECREF(item); bpy_pydriver_evaltime_prev = evaltime; } @@ -301,7 +303,10 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime) /* try to add to dictionary */ /* if (PyDict_SetItemString(driver_vars, dvar->name, driver_arg)) { */ - if (PyDict_SetItem(driver_vars, PyTuple_GET_ITEM(expr_vars, i++), driver_arg) < 0) { + if (PyDict_SetItem(driver_vars, PyTuple_GET_ITEM(expr_vars, i++), driver_arg) != -1) { + Py_DECREF(driver_arg); + } + else { /* this target failed - bad name */ if (targets_ok) { /* first one - print some extra info for easier identification */ diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index a120e4886e0..9c417cfd221 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -264,8 +264,13 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args)) if (BKE_idcode_is_linkable(code)) { const char *name_plural = BKE_idcode_to_name_plural(code); PyObject *str = PyUnicode_FromString(name_plural); - PyDict_SetItem(self->dict, str, PyList_New(0)); - PyDict_SetItem(from_dict, str, _bpy_names(self, code)); + PyObject *item; + + PyDict_SetItem(self->dict, str, item = PyList_New(0)); + Py_DECREF(item); + PyDict_SetItem(from_dict, str, item = _bpy_names(self, code)); + Py_DECREF(item); + Py_DECREF(str); } } |