Merged revisions 110083 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Wed, 19 Mar 2008 20:34:13 +0000 (20:34 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 19 Mar 2008 20:34:13 +0000 (20:34 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r110083 | mmichelson | 2008-03-19 15:33:03 -0500 (Wed, 19 Mar 2008) | 4 lines

Add a missing unlock in the case that memory allocation fails in app_chanspy.
Thanks to Russell for confirming that this was an issue.

........

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

apps/app_chanspy.c

index f37de38..66a2d21 100644 (file)
@@ -478,16 +478,15 @@ static struct chanspy_ds *setup_chanspy_ds(struct ast_channel *chan, struct chan
 
        ast_mutex_lock(&chanspy_ds->lock);
 
-       chanspy_ds->chan = chan;
-
        if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, NULL))) {
+               ast_mutex_unlock(&chanspy_ds->lock);
                chanspy_ds = chanspy_ds_free(chanspy_ds);
                ast_channel_unlock(chan);
                return NULL;
        }
-
+       
+       chanspy_ds->chan = chan;
        datastore->data = chanspy_ds;
-
        ast_channel_datastore_add(chan, datastore);
 
        return chanspy_ds;