]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a missing unlock in the case that memory allocation fails in app_chanspy.
authorMark Michelson <mmichelson@digium.com>
Wed, 19 Mar 2008 20:33:03 +0000 (20:33 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 19 Mar 2008 20:33:03 +0000 (20:33 +0000)
Thanks to Russell for confirming that this was an issue.

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

apps/app_chanspy.c

index 6152a74dabc0b4803e2da0c380e6cb84632756bb..ee496f0927386dbc803b13a6cfbcad517dc3d9d6 100644 (file)
@@ -441,16 +441,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;