mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
command: fix dangling pointer issue in script key bindings code
This code was sending a string to a different thread, and then deallocated the string shortly after, which means most of the time the other thread was accessing a dangling pointer. It's possible that this is the cause for #1002.
This commit is contained in:
parent
ece61bfa10
commit
b016f92309
@ -3894,7 +3894,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||||||
*event = (mpv_event_client_message){0};
|
*event = (mpv_event_client_message){0};
|
||||||
for (int n = 1; n < cmd->nargs; n++) {
|
for (int n = 1; n < cmd->nargs; n++) {
|
||||||
MP_TARRAY_APPEND(event, event->args, event->num_args,
|
MP_TARRAY_APPEND(event, event->args, event->num_args,
|
||||||
cmd->args[n].v.s);
|
talloc_strdup(event, cmd->args[n].v.s));
|
||||||
}
|
}
|
||||||
if (mp_client_send_event(mpctx, cmd->args[0].v.s,
|
if (mp_client_send_event(mpctx, cmd->args[0].v.s,
|
||||||
MPV_EVENT_CLIENT_MESSAGE, event) < 0)
|
MPV_EVENT_CLIENT_MESSAGE, event) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user