[asterisk-commits] mmichelson: trunk r118157 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 23 14:57:40 CDT 2008


Author: mmichelson
Date: Fri May 23 14:57:40 2008
New Revision: 118157

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118157
Log:
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


Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=118157&r1=118156&r2=118157
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri May 23 14:57:40 2008
@@ -9166,6 +9166,8 @@
 	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 @@
 		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) {




More information about the asterisk-commits mailing list