]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
* Made ast_change_name() hold the channels container lock while changing the channel...
authorRichard Mudgett <rmudgett@digium.com>
Thu, 10 May 2012 23:38:16 +0000 (23:38 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 10 May 2012 23:38:16 +0000 (23:38 +0000)
* Eliminate redundant list not empty check in clone_variables().

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

main/channel.c

index 499ada002c0ef3eeebe9d3cc9bcc3972a9de7b77..cefc255d2229d61cb78dead0bc963d1a415effda 100644 (file)
@@ -6105,11 +6105,13 @@ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newna
 void ast_change_name(struct ast_channel *chan, const char *newname)
 {
        /* We must re-link, as the hash value will change here. */
-       ao2_unlink(channels, chan);
+       ao2_lock(channels);
        ast_channel_lock(chan);
+       ao2_unlink(channels, chan);
        __ast_change_name_nolink(chan, newname);
-       ast_channel_unlock(chan);
        ao2_link(channels, chan);
+       ast_channel_unlock(chan);
+       ao2_unlock(channels);
 }
 
 void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
@@ -6166,8 +6168,7 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl
        struct ast_var_t *current, *newvar;
        /* Append variables from clone channel into original channel */
        /* XXX Is this always correct?  We have to in order to keep MACROS working XXX */
-       if (AST_LIST_FIRST(&clonechan->varshead))
-               AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
+       AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
 
        /* then, dup the varshead list into the clone */