[asterisk-commits] mmichelson: branch mmichelson/trunk-digiumphones r366918 - in /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 18 09:48:23 CDT 2012


Author: mmichelson
Date: Fri May 18 09:48:09 2012
New Revision: 366918

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366918
Log:
Address Kinsey's findings on review 1883.

* Check for failure of alloca calls
* Remove some trailing whitespace
* Remove a set but not used variable.

Review: https://reviewboard.asterisk.org/r/1883


Modified:
    team/mmichelson/trunk-digiumphones/apps/app_voicemail.c
    team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c

Modified: team/mmichelson/trunk-digiumphones/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/trunk-digiumphones/apps/app_voicemail.c?view=diff&rev=366918&r1=366917&r2=366918
==============================================================================
--- team/mmichelson/trunk-digiumphones/apps/app_voicemail.c (original)
+++ team/mmichelson/trunk-digiumphones/apps/app_voicemail.c Fri May 18 09:48:09 2012
@@ -15009,7 +15009,12 @@
 		goto vm_forward_cleanup;
 	}
 
-	msg_nums = alloca(sizeof(int) * num_msgs);
+	if (!(msg_nums = alloca(sizeof(int) * num_msgs)))
+	{
+		ast_log(LOG_ERROR, "Unable to allocate stack space! Expect awful things!\n");
+		res = -1;
+		goto vm_forward_cleanup;
+	}
 
 	if ((res = message_range_and_existence_check(&from_vms, msg_ids, num_msgs, msg_nums) < 0)) {
 		goto vm_forward_cleanup;
@@ -15134,7 +15139,12 @@
 		goto vm_move_cleanup;
 	}
 
-	old_msg_nums = alloca(sizeof(int) * num_msgs);
+	if (!(old_msg_nums = alloca(sizeof(int) * num_msgs))) {
+		ast_log(LOG_ERROR, "Unable to allocate stack space! Expect awful things!\n");
+		res = -1;
+		goto vm_move_cleanup;
+	}
+
 	if ((res = message_range_and_existence_check(&vms, old_msg_ids, num_msgs, old_msg_nums)) < 0) {
 		goto vm_move_cleanup;
 	}
@@ -15234,7 +15244,12 @@
 		goto vm_remove_cleanup;
 	}
 
-	msg_nums = alloca(sizeof(int) * num_msgs);
+	if (!(msg_nums = alloca(sizeof(int) * num_msgs))) {
+		ast_log(LOG_ERROR, "Unable to allocate stack space! Expect awful things\n");
+		res = -1;
+		goto vm_remove_cleanup;
+	}
+
 	if ((res = message_range_and_existence_check(&vms, msgs, num_msgs, msg_nums)) < 0) {
 		goto vm_remove_cleanup;
 	}

Modified: team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c?view=diff&rev=366918&r1=366917&r2=366918
==============================================================================
--- team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c (original)
+++ team/mmichelson/trunk-digiumphones/tests/test_voicemail_api.c Fri May 18 09:48:09 2012
@@ -847,7 +847,7 @@
 	VM_API_TEST_SETUP;
 	old_msg_id = test_snapshots[0]->msg_id;
 	inbox_msg_id = test_snapshots[1]->msg_id;
-	
+
 	multi_msg_ids[0] = test_snapshots[2]->msg_id;
 	multi_msg_ids[1] = test_snapshots[3]->msg_id;
 
@@ -1081,7 +1081,6 @@
 {
 	struct ast_vm_mailbox_snapshot *test_mbox_snapshot = NULL;
 	const char *inbox_msg_id;
-	const char *old_msg_id;
 	const char *multi_msg_ids[2];
 
 	switch (cmd) {
@@ -1099,7 +1098,6 @@
 
 	VM_API_TEST_SETUP;
 
-	old_msg_id = test_snapshots[0]->msg_id;
 	inbox_msg_id = test_snapshots[1]->msg_id;
 
 	multi_msg_ids[0] = test_snapshots[2]->msg_id;




More information about the asterisk-commits mailing list