diff options
author | dudemanguy <random342@airmail.cc> | 2019-07-08 08:23:04 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-07-08 16:42:47 +0200 |
commit | 65b1c2d06518108acfc5be4267b9d5284ae614ef (patch) | |
tree | 9c32a3e8d85c2839e7bd61ffd2706553e3e76a15 | |
parent | b5b0350371e25a1a54ab087e078ac24cd5c104e7 (diff) | |
download | mpv-65b1c2d06518108acfc5be4267b9d5284ae614ef.tar.bz2 mpv-65b1c2d06518108acfc5be4267b9d5284ae614ef.tar.xz |
client: fix potential mpv_cmd/async leak
-rw-r--r-- | player/client.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/player/client.c b/player/client.c index 03e0cbfeb6..4199dcc638 100644 --- a/player/client.c +++ b/player/client.c @@ -1035,10 +1035,12 @@ static void cmd_complete(struct mp_cmd_ctx *cmd) static int run_client_command(mpv_handle *ctx, struct mp_cmd *cmd, mpv_node *res) { - if (!ctx->mpctx->initialized) - return MPV_ERROR_UNINITIALIZED; if (!cmd) return MPV_ERROR_INVALID_PARAMETER; + if (!ctx->mpctx->initialized) { + talloc_free(cmd); + return MPV_ERROR_UNINITIALIZED; + } cmd->sender = ctx->name; @@ -1139,10 +1141,12 @@ static void async_cmd_fn(void *data) static int run_async_cmd(mpv_handle *ctx, uint64_t ud, struct mp_cmd *cmd) { - if (!ctx->mpctx->initialized) - return MPV_ERROR_UNINITIALIZED; if (!cmd) return MPV_ERROR_INVALID_PARAMETER; + if (!ctx->mpctx->initialized) { + talloc_free(cmd); + return MPV_ERROR_UNINITIALIZED; + } cmd->sender = ctx->name; |