Fix T72894: Mantaflow: several crashes due to null pointers

Incorporated LazyDodo's suggestions from the task.
This commit is contained in:
Sebastián Barschkis 2020-01-22 11:17:34 +01:00
parent 908ed661ee
commit c4b5279bbc
Notes: blender-bot 2023-02-14 05:43:04 +01:00
Referenced by issue #72894, Mantaflow: several crashes due to null pointers.
1 changed files with 4 additions and 1 deletions

View File

@ -2057,7 +2057,10 @@ static char *pyObjectToString(PyObject *inputObject)
PyObject *encoded = PyUnicode_AsUTF8String(inputObject);
char *result = PyBytes_AsString(encoded);
Py_DECREF(encoded);
/* Do not decref (i.e. Py_DECREF(encoded)) of string 'encoded' PyObject.
* Otherwise those objects will be invalidated too early (see T72894).
* Reference count of those Python objects will be decreased with 'del' in Python scripts. */
Py_DECREF(inputObject);
PyGILState_Release(gilstate);