summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/ari/resource_channels.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 6027a8059..6b4f26c25 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -99,9 +99,13 @@ static int channel_state_invalid(struct stasis_app_control *control,
|| snapshot->state == AST_STATE_RINGING) {
ast_ari_response_error(response, 412, "Precondition Failed",
"Channel in invalid state");
+ ao2_ref(snapshot, -1);
+
return -1;
}
+ ao2_ref(snapshot, -1);
+
return 0;
}