From 739cd61024a1c373ebb8c255b2c78a5410f399b6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Sep 2013 18:32:36 +0200 Subject: 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. --- mpvcore/input/input.c | 4 ++-- 1 file 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; } -- cgit v1.2.3