mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Dont leak kitty_run_data on error
This commit is contained in:
parent
f023f047ff
commit
560b78bc35
@ -55,8 +55,8 @@ set_kitty_run_data(RunData *run_data, bool from_source, wchar_t *extensions_dir)
|
||||
PyObject *ans = PyDict_New();
|
||||
if (!ans) { PyErr_Print(); return false; }
|
||||
PyObject *exe_dir = PyUnicode_DecodeFSDefaultAndSize(run_data->exe_dir, strlen(run_data->exe_dir));
|
||||
if (exe_dir == NULL) { fprintf(stderr, "Fatal error: cannot decode exe_dir: %s\n", run_data->exe_dir); PyErr_Print(); return false; }
|
||||
#define S(key, val) { if (!val) { PyErr_Print(); return false; } int ret = PyDict_SetItemString(ans, #key, val); Py_CLEAR(val); if (ret != 0) { PyErr_Print(); return false; } }
|
||||
if (exe_dir == NULL) { fprintf(stderr, "Fatal error: cannot decode exe_dir: %s\n", run_data->exe_dir); PyErr_Print(); Py_CLEAR(ans); return false; }
|
||||
#define S(key, val) { if (!val) { PyErr_Print(); Py_CLEAR(ans); return false; } int ret = PyDict_SetItemString(ans, #key, val); Py_CLEAR(val); if (ret != 0) { PyErr_Print(); Py_CLEAR(ans); return false; } }
|
||||
S(bundle_exe_dir, exe_dir);
|
||||
if (from_source) {
|
||||
PyObject *one = Py_True; Py_INCREF(one);
|
||||
|
Loading…
Reference in New Issue
Block a user