summaryrefslogtreecommitdiffstats
path: root/player/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/client.c')
-rw-r--r--player/client.c12
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;