Fix memory leak when there is an error evaluating a PyDriver

In practice users are unlikely to ever run into this error.
This commit is contained in:
Campbell Barton 2022-03-15 15:03:27 +11:00
parent 3cbf20228e
commit 977c958242
1 changed files with 2 additions and 1 deletions

View File

@ -575,7 +575,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
/* 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) != -1) {
Py_DECREF(driver_arg);
/* Pass. */
}
else {
/* this target failed - bad name */
@ -591,6 +591,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
PyErr_Print();
PyErr_Clear();
}
Py_DECREF(driver_arg);
}
#ifdef USE_BYTECODE_WHITELIST