]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make Asterisk less crashy.
authorRussell Bryant <russell@russellbryant.com>
Wed, 24 Nov 2010 23:26:43 +0000 (23:26 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 24 Nov 2010 23:26:43 +0000 (23:26 +0000)
Since we might not put a new translation path on the channel, go ahead and
set it to NULL right after destroying the old one to ensure we don't try
to free an invalid translation path later on.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@296213 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 175c0bd5e5481368068f2989204f01763bc4dab1..0e3c315fd83343ddb41bec7bde831c6b080e003a 100644 (file)
@@ -3400,8 +3400,10 @@ static int set_format(struct ast_channel *chan, int fmt, int *rawformat, int *fo
        /* User perspective is fmt */
        *format = fmt;
        /* Free any read translation we have right now */
-       if (*trans)
+       if (*trans) {
                ast_translator_free_path(*trans);
+               *trans = NULL;
+       }
        /* Build a translation path from the raw format to the desired format */
        if (*format == *rawformat) {
                /*