]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 105570 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Mon, 3 Mar 2008 17:17:27 +0000 (17:17 +0000)
committerRussell Bryant <russell@russellbryant.com>
Mon, 3 Mar 2008 17:17:27 +0000 (17:17 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

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

channels/chan_local.c

index 983c6382561182d330deaa88e7aa51ec758daa06..ffd25bc33ac39f3ecad7222fd8d5033d48512827 100644 (file)
@@ -157,6 +157,9 @@ static int local_devicestate(void *data)
        return res;
 }
 
+/*!
+ * \note Assumes the pvt is no longer in the pvts list
+ */
 static struct local_pvt *local_pvt_destroy(struct local_pvt *pvt)
 {
        ast_mutex_destroy(&pvt->lock);
@@ -693,8 +696,12 @@ static struct ast_channel *local_request(const char *type, int format, void *dat
 
        /* Allocate a new private structure and then Asterisk channel */
        if ((p = local_alloc(data, format))) {
-               if (!(chan = local_new(p, AST_STATE_DOWN)))
+               if (!(chan = local_new(p, AST_STATE_DOWN))) {
+                       AST_LIST_LOCK(&locals);
+                       AST_LIST_REMOVE(&locals, p, list);
+                       AST_LIST_UNLOCK(&locals);
                        p = local_pvt_destroy(p);
+               }
        }
 
        return chan;