summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchannels/chan_iax2.c11
-rwxr-xr-xres/res_monitor.c4
2 files changed, 8 insertions, 7 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index fa8e3df4c..a2257fe38 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -6421,7 +6421,7 @@ int reload(void)
return reload_config();
}
-static int cache_get_callno(char *data)
+static int cache_get_callno_locked(char *data)
{
struct sockaddr_in sin;
int x;
@@ -6437,7 +6437,6 @@ static int cache_get_callno(char *data)
look up entries for a single context */
if (!ast_mutex_trylock(&iaxsl[x])) {
if (iaxs[x] && !strcasecmp(data, iaxs[x]->dproot)) {
- ast_mutex_unlock(&iaxsl[x]);
return x;
}
ast_mutex_unlock(&iaxsl[x]);
@@ -6501,7 +6500,6 @@ static int cache_get_callno(char *data)
#endif
/* Start the call going */
send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_NEW, 0, ied.buf, ied.pos, -1);
- ast_mutex_unlock(&iaxsl[callno]);
return callno;
}
@@ -6548,14 +6546,16 @@ static struct iax2_dpcache *find_cache(struct ast_channel *chan, char *data, cha
if (!dp) {
/* No matching entry. Create a new one. */
/* First, can we make a callno? */
- callno = cache_get_callno(data);
+ callno = cache_get_callno_locked(data);
if (callno < 0) {
ast_log(LOG_WARNING, "Unable to generate call for '%s'\n", data);
return NULL;
}
dp = malloc(sizeof(struct iax2_dpcache));
- if (!dp)
+ if (!dp) {
+ ast_mutex_unlock(&iaxsl[callno]);
return NULL;
+ }
memset(dp, 0, sizeof(struct iax2_dpcache));
strncpy(dp->peercontext, data, sizeof(dp->peercontext)-1);
strncpy(dp->exten, exten, sizeof(dp->exten)-1);
@@ -6573,6 +6573,7 @@ static struct iax2_dpcache *find_cache(struct ast_channel *chan, char *data, cha
/* Send the request if we're already up */
if (iaxs[callno]->state & IAX_STATE_STARTED)
iax2_dprequest(dp, callno);
+ ast_mutex_unlock(&iaxsl[callno]);
}
/* By here we must have a dp */
if (dp->flags & CACHE_FLAG_PENDING) {
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 56eaaf956..3f85b1f1e 100755
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -172,7 +172,7 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
/* Stop monitoring a channel */
int ast_monitor_stop( struct ast_channel *chan, int need_lock )
{
- char *execute=NULL;
+ char *execute;
int soxmix =0;
if(need_lock) {
if(ast_mutex_lock(&chan->lock)) {
@@ -219,7 +219,7 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
}
}
- if (chan->monitor->joinfiles && !ast_strlen_zero(execute) && strlen(chan->monitor->filename_base)) {
+ if (chan->monitor->joinfiles && strlen(chan->monitor->filename_base)) {
char tmp[1024];
char tmp2[1024];
char *format = !strcasecmp(chan->monitor->format,"wav49") ? "WAV" : chan->monitor->format;