[svn-commits] russell: trunk r443 - /trunk/chan_mobile.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Sep 7 21:17:53 CDT 2007


Author: russell
Date: Fri Sep  7 21:17:53 2007
New Revision: 443

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=443
Log:
Change an allocation from the heap to the stack for a variable that is only
used within the function

Modified:
    trunk/chan_mobile.c

Modified: trunk/chan_mobile.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/chan_mobile.c?view=diff&rev=443&r1=442&r2=443
==============================================================================
--- trunk/chan_mobile.c (original)
+++ trunk/chan_mobile.c Fri Sep  7 21:17:53 2007
@@ -299,7 +299,7 @@
 	max_rsp = 255;
 	flags = IREQ_CACHE_FLUSH;
 
-	ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
+	ii = alloca(max_rsp * sizeof(inquiry_info));
 	num_rsp = hci_inquiry(adapter->dev_id, len, max_rsp, NULL, &ii, flags);
 	if (num_rsp > 0) {
 		ast_cli(fd, FORMAT2, "Address", "Name", "Usable", "Type", "Port");
@@ -317,8 +317,6 @@
 		}
 	} else
 		ast_cli(fd, "No Bluetooth Cell / Mobile devices found.\n");
-
-	free(ii);
 
 	return RESULT_SUCCESS;
 




More information about the svn-commits mailing list