]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_read: Release tone zone reference on early return.
authorSean Bright <sean.bright@gmail.com>
Wed, 3 Feb 2021 18:53:03 +0000 (13:53 -0500)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 4 Feb 2021 15:57:24 +0000 (09:57 -0600)
Change-Id: I350939f2220f9e5d44ddf4c8d9a4c99fde4d169a

apps/app_read.c

index f9193571d74fa0f759d6abdbfbd202deb90074c8..6398281bec509aae2f1e670d7c7f2ad114fa6b6c 100644 (file)
@@ -195,6 +195,9 @@ static int read_exec(struct ast_channel *chan, const char *data)
        if (ast_channel_state(chan) != AST_STATE_UP) {
                if (ast_test_flag(&flags, OPT_SKIP)) {
                        /* At the user's option, skip if the line is not up */
+                       if (ts) {
+                               ts = ast_tone_zone_sound_unref(ts);
+                       }
                        pbx_builtin_setvar_helper(chan, arglist.variable, "");
                        pbx_builtin_setvar_helper(chan, "READSTATUS", "SKIPPED");
                        return 0;