summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2006-04-07 14:30:14 +0000
committerOlle Johansson <oej@edvina.net>2006-04-07 14:30:14 +0000
commit48ca2c82bfab6854daa13586a66bf08080c5efb0 (patch)
tree300d305eacaeab6d66429fae76690fd157c1693b
parentece21c30199a001daba42a3e99c743081305954f (diff)
Import of revistion 18250 from 1.2
- Fix minor memory leak - Add proper cause codes on memory allocation failures git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@18261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 45ed4731b..9140f85f2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12114,16 +12114,22 @@ static struct ast_channel *sip_request_call(const char *type, int format, void *
char *dest = data;
oldformat = format;
- format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1);
- if (!format) {
+ if ((format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) {
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format %s while capability is %s\n", ast_getformatname(oldformat), ast_getformatname(global_capability));
return NULL;
}
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE)))
+ if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE))) {
+ ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory)\n", (char *)data);
+ *cause = AST_CAUSE_CONGESTION;
return NULL;
+ }
- if (!(p->options = ast_calloc(1, sizeof(*p->options))))
+ if (!(p->options = ast_calloc(1, sizeof(*p->options)))) {
+ sip_destroy(p);
+ ast_log(LOG_ERROR, "Unable to build option SIP data structure - Out of memory\n");
+ *cause = AST_CAUSE_CONGESTION;
return NULL;
+ }
ast_copy_string(tmp, dest, sizeof(tmp));
host = strchr(tmp, '@');