diff options
author | citats <citats@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-25 17:57:25 +0000 |
---|---|---|
committer | citats <citats@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-10-25 17:57:25 +0000 |
commit | edb2f913410744051e9b25fb403eb5538c9bf326 (patch) | |
tree | 351c4ae84f1f2d644bdfbb628fe48a8483694dcb /res/res_monitor.c | |
parent | 175f7e8a0aad8ac90fd1f93eadb98e09c34b54f6 (diff) |
Backport recent memory fixes to 1.0
git-svn-id: http://svn.digium.com/svn/asterisk/branches/v1-0@4094 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_monitor.c')
-rwxr-xr-x | res/res_monitor.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c index c36460c5a..2a0b00fa4 100755 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -90,6 +90,11 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, } monitor = malloc(sizeof(struct ast_channel_monitor)); + if (!monitor) { + if (need_lock) + ast_mutex_unlock(&chan->lock); + return -1; + } memset(monitor, 0, sizeof(struct ast_channel_monitor)); /* Determine file names */ @@ -391,6 +396,11 @@ static int start_monitor_action(struct mansession *s, struct message *m) if ((!fname) || (ast_strlen_zero(fname))) { // No filename base specified, default to channel name as per CLI fname = malloc (FILENAME_MAX); + if (!fname) { + astman_send_error(s, m, "Could not start monitoring channel"); + ast_mutex_unlock(&c->lock); + return 0; + } memset(fname, 0, FILENAME_MAX); strncpy(fname, c->name, FILENAME_MAX-1); // Channels have the format technology/channel_name - have to replace that / |