mirror of https://github.com/mpv-player/mpv
input: fix memory leak with scalable input and nonscalable commands
With scalable input source, scale_units can be 0, and cmd is not
freed. Fix this by freeing cmd when scale_units is 0.
Fixes: 937128697f
This commit is contained in:
parent
70aaba71d6
commit
1c9d066c9e
|
@ -672,8 +672,11 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale,
|
|||
scale_units = MPMIN(scale_units, 20);
|
||||
for (int i = 0; i < scale_units - 1; i++)
|
||||
queue_cmd(ictx, mp_cmd_clone(cmd));
|
||||
if (scale_units)
|
||||
if (scale_units) {
|
||||
queue_cmd(ictx, cmd);
|
||||
} else {
|
||||
talloc_free(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue