diff options
author | wm4 <wm4@nowhere> | 2013-09-11 18:32:36 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-11 18:32:36 +0200 |
commit | 739cd61024a1c373ebb8c255b2c78a5410f399b6 (patch) | |
tree | 1f0ddb67e3aa166ecb657b41cbaf943163be635b /mpvcore | |
parent | 763f33424e7aba1800f3f0eee2a81a6cfe8d43ba (diff) | |
download | mpv-739cd61024a1c373ebb8c255b2c78a5410f399b6.tar.bz2 mpv-739cd61024a1c373ebb8c255b2c78a5410f399b6.tar.xz |
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.
Diffstat (limited to 'mpvcore')
-rw-r--r-- | mpvcore/input/input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mpvcore/input/input.c b/mpvcore/input/input.c index da6a52fcaa..902aa52b47 100644 --- a/mpvcore/input/input.c +++ b/mpvcore/input/input.c @@ -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; } |