From: Mark Michelson Date: Wed, 19 Mar 2008 20:33:03 +0000 (+0000) Subject: Add a missing unlock in the case that memory allocation fails in app_chanspy. X-Git-Tag: 1.4.19-rc4~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ebb67cf852bfd6d9cd763ed5573e3fe48c0bfb7e;p=thirdparty%2Fasterisk.git 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/branches/1.4@110083 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 6152a74dab..ee496f0927 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -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;