From d98317c7ad1342ba71dbfb5fbf3bbf96147920d4 Mon Sep 17 00:00:00 2001 From: Olle Johansson Date: Fri, 7 Apr 2006 13:47:32 +0000 Subject: [PATCH] - Fix possible minor memory leak in chan_sip - Return proper cause code on memory allocation error git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@18250 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 0d939923ad..6df70ebfcc 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11552,13 +11552,16 @@ static struct ast_channel *sip_request_call(const char *type, int format, void * } p = sip_alloc(NULL, NULL, 0, SIP_INVITE); if (!p) { - ast_log(LOG_WARNING, "Unable to build sip pvt data for '%s'\n", (char *)data); + ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory)\n", (char *)data); + *cause = AST_CAUSE_CONGESTION; return NULL; } p->options = calloc(1, sizeof(*p->options)); if (!p->options) { - ast_log(LOG_ERROR, "Out of memory\n"); + sip_destroy(p); + ast_log(LOG_ERROR, "Unable to build option SIP data structure - Out of memory\n"); + *cause = AST_CAUSE_CONGESTION; return NULL; } -- 2.47.2