summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-05-23 19:57:40 +0000
committerMark Michelson <mmichelson@digium.com>2008-05-23 19:57:40 +0000
commit7e49fd2f0e31f7a1e881f8936e6ce69ec0a00639 (patch)
tree1196f0a912a3710be261e2d9d657f920fd530dcf /apps
parentebb4ba3b9aca59e34e14cf7267840dde3986d4aa (diff)
Use a deep copy on strings that come from ast_events. Otherwise it is
likely that after the event is freed, we no longer refer to valid memory. (closes issue #12712) Reported by: tomo1657 Patches: 12712.patch uploaded by putnopvut (license 60) Tested by: tomo1657 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 4bbcd8d4b..2ba0a3cf9 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -9166,6 +9166,8 @@ static int handle_subscribe(void *datap)
AST_RWLIST_WRLOCK(&mwi_subs);
AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
AST_RWLIST_UNLOCK(&mwi_subs);
+ ast_free(p->mailbox);
+ ast_free(p->context);
ast_free(p);
return 0;
}
@@ -9200,8 +9202,8 @@ static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
ast_log(LOG_ERROR, "could not allocate a mwi_sub_task\n");
return;
}
- mwist->mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
- mwist->context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
+ mwist->mailbox = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX));
+ mwist->context = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT));
mwist->uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {