mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-07-04 23:03:29 +00:00
Add null check for strdup in dnd_test_drag_notify
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/3c7e550c-e8e8-413e-a54b-87d61cb8e574 Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
parent
e8e2b31182
commit
48523efc7f
1 changed files with 2 additions and 1 deletions
|
|
@ -2146,9 +2146,10 @@ dnd_test_drag_notify(PyObject *self UNUSED, PyObject *args) {
|
|||
Window *w = window_for_window_id((id_type)window_id);
|
||||
if (!w) { PyErr_SetString(PyExc_ValueError, "Window not found"); return NULL; }
|
||||
if (type < 0 || type > 3) { PyErr_SetString(PyExc_ValueError, "Invalid type"); return NULL; }
|
||||
if (accepted_mime) {
|
||||
if (accepted_mime && *accepted_mime) {
|
||||
free(global_state.drag_source.accepted_mime_type);
|
||||
global_state.drag_source.accepted_mime_type = strdup(accepted_mime);
|
||||
if (!global_state.drag_source.accepted_mime_type) { PyErr_NoMemory(); return NULL; }
|
||||
}
|
||||
global_state.drag_source.action = action;
|
||||
global_state.drag_source.was_canceled = was_canceled;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue