mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 23:00:41 +00:00
input: fix accidental NULL pointer dereference
This could happen if the input queue was full, and an unmapped key was used, or something like this. Possibly fixes github issue #224.
This commit is contained in:
parent
763f33424e
commit
739cd61024
@ -1515,7 +1515,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale)
|
|||||||
ictx->last_key_down = mp_time_us();
|
ictx->last_key_down = mp_time_us();
|
||||||
ictx->ar_state = 0;
|
ictx->ar_state = 0;
|
||||||
cmd = get_cmd_from_keys(ictx, NULL, ictx->num_key_down, ictx->key_down);
|
cmd = get_cmd_from_keys(ictx, NULL, ictx->num_key_down, ictx->key_down);
|
||||||
if (should_drop_cmd(ictx, cmd)) {
|
if (cmd && should_drop_cmd(ictx, cmd)) {
|
||||||
ictx->num_key_down--;
|
ictx->num_key_down--;
|
||||||
talloc_free(cmd);
|
talloc_free(cmd);
|
||||||
return;
|
return;
|
||||||
@ -1552,7 +1552,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale)
|
|||||||
num_key_down++;
|
num_key_down++;
|
||||||
}
|
}
|
||||||
cmd = get_cmd_from_keys(ictx, NULL, num_key_down, key_down);
|
cmd = get_cmd_from_keys(ictx, NULL, num_key_down, key_down);
|
||||||
if (should_drop_cmd(ictx, cmd)) {
|
if (cmd && should_drop_cmd(ictx, cmd)) {
|
||||||
talloc_free(cmd);
|
talloc_free(cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user