summaryrefslogtreecommitdiff
path: root/channels/chan_motif.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-08-27 16:51:08 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-08-27 16:51:08 +0000
commit868be02a2f33e77473ceebe89023af51a2459404 (patch)
treef11f70f13c2702c1490f03d00ae48de96f1bb596 /channels/chan_motif.c
parent24c56515b1f3b99654cfaff5cc58a2c5aa88dc2b (diff)
Fix uninitialized value in struct ast_control_pvt_cause_code usage.
........ Merged revisions 397744 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 397745 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_motif.c')
-rw-r--r--channels/chan_motif.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index c77d0c0d2..72118ce10 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -2532,7 +2532,8 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st
/* Size of the string making up the cause code is "Motif " + text */
data_size += 6 + strlen(iks_name(text));
- cause_code = ast_malloc(data_size);
+ cause_code = ast_alloca(data_size);
+ memset(cause_code, 0, data_size);
/* Get the appropriate cause code mapping for this reason */
for (i = 0; i < ARRAY_LEN(jingle_reason_mappings); i++) {
@@ -2546,7 +2547,8 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st
snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "Motif %s", iks_name(text));
} else {
/* No technology specific information is available */
- cause_code = ast_malloc(data_size);
+ cause_code = ast_alloca(data_size);
+ memset(cause_code, 0, data_size);
}
ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME);
@@ -2554,8 +2556,6 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st
ast_queue_control_data(chan, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(chan, cause_code, data_size);
- ast_free(cause_code);
-
ast_debug(3, "Hanging up channel '%s' due to session terminate message with cause '%d'\n", ast_channel_name(chan), cause);
ast_queue_hangup_with_cause(chan, cause);
session->gone = 1;