1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 16:33:02 +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:
wm4 2013-09-11 18:32:36 +02:00
parent 763f33424e
commit 739cd61024

View File

@ -1515,7 +1515,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale)
ictx->last_key_down = mp_time_us();
ictx->ar_state = 0;
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--;
talloc_free(cmd);
return;
@ -1552,7 +1552,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale)
num_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);
return;
}