[asterisk-addons-commits] mnicholson: trunk r841 - /trunk/channels/chan_mobile.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Mon Apr 6 10:43:11 CDT 2009


Author: mnicholson
Date: Mon Apr  6 10:43:08 2009
New Revision: 841

URL: http://svn.digium.com/svn-view/asterisk-addons?view=rev&rev=841
Log:
Use ast_calloc() to when allocating list members instead of ast_malloc().  This
should fix a crash with an uninitalized next pointer.

Modified:
    trunk/channels/chan_mobile.c

Modified: trunk/channels/chan_mobile.c
URL: http://svn.digium.com/svn-view/asterisk-addons/trunk/channels/chan_mobile.c?view=diff&rev=841&r1=840&r2=841
==============================================================================
--- trunk/channels/chan_mobile.c (original)
+++ trunk/channels/chan_mobile.c Mon Apr  6 10:43:08 2009
@@ -2722,12 +2722,11 @@
 static int msg_queue_push(struct mbl_pvt *pvt, at_message_t expect, at_message_t response_to)
 {
 	struct msg_queue_entry *msg;
-	if (!(msg = ast_malloc(sizeof(*msg)))) {
+	if (!(msg = ast_calloc(1, sizeof(*msg)))) {
 		return -1;
 	}
 	msg->expected = expect;
 	msg->response_to = response_to;
-	msg->data = NULL;
 
 	AST_LIST_INSERT_TAIL(&pvt->msg_queue, msg, entry);
 	return 0;
@@ -2745,7 +2744,7 @@
 static int msg_queue_push_data(struct mbl_pvt *pvt, at_message_t expect, at_message_t response_to, void *data)
 {
 	struct msg_queue_entry *msg;
-	if (!(msg = ast_malloc(sizeof(*msg)))) {
+	if (!(msg = ast_calloc(1, sizeof(*msg)))) {
 		return -1;
 	}
 	msg->expected = expect;




More information about the asterisk-addons-commits mailing list