mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
obs-scripting: Fix script_path() python mem corruption
Returning PyObject with borrowed reference will result in double free and/or use after free issue. Issue seen as crash when running Python script calling script_path().
This commit is contained in:
parent
32bb14ddea
commit
318779be7a
7
deps/obs-scripting/obs-scripting-python.c
vendored
7
deps/obs-scripting/obs-scripting-python.c
vendored
|
@ -147,8 +147,13 @@ void add_functions_to_py_module(PyObject *module, PyMethodDef *method_list)
|
|||
|
||||
static PyObject *py_get_current_script_path(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *dir;
|
||||
|
||||
UNUSED_PARAMETER(args);
|
||||
return PyDict_GetItemString(PyModule_GetDict(self), "__script_dir__");
|
||||
|
||||
dir = PyDict_GetItemString(PyModule_GetDict(self), "__script_dir__");
|
||||
Py_XINCREF(dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
static void get_defaults(struct obs_python_script *data, PyObject *get_defs)
|
||||
|
|
Loading…
Reference in a new issue