[asterisk-dev] [Code Review] remove checks for alloca and ast_strdupa NULL return value

wdoekes reviewboard at asterisk.org
Thu Jul 12 13:28:49 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2032/
-----------------------------------------------------------

(Updated July 12, 2012, 1:28 p.m.)


Review request for Asterisk Developers and Tilghman Lesher.


Changes
-------

In this[1] FreeBSD alloca manual, there is no reference to it returning
NULL or anything other than a hopefully usable block of memory.

[1] http://www.unix.com/man-page/FreeBSD/3/alloca/


But, I believe the gcc __builtin_alloca guarantees it won't return NULL,
but fail in more mysterious ways instead or SEGFAULT. So, I added an
ast_alloca macro that expands to that.

Does this suit you better?


Summary (updated)
-------

alloca and ast_strdupa shouldn't be checked for NULL. Replaced all calls to alloca() with ast_alloca() which calls the gcc __builtin_alloca() to avoid BSD semantics.


This addresses bug ASTERISK-20125.
    https://issues.asterisk.org/jira/browse/ASTERISK-20125


Diffs (updated)
-----

  /branches/1.8/addons/app_mysql.c 369969 
  /branches/1.8/addons/chan_mobile.c 369969 
  /branches/1.8/addons/res_config_mysql.c 369969 
  /branches/1.8/apps/app_dictate.c 369969 
  /branches/1.8/apps/app_directed_pickup.c 369969 
  /branches/1.8/apps/app_festival.c 369969 
  /branches/1.8/apps/app_getcpeid.c 369969 
  /branches/1.8/apps/app_macro.c 369969 
  /branches/1.8/apps/app_meetme.c 369969 
  /branches/1.8/apps/app_minivm.c 369969 
  /branches/1.8/apps/app_mixmonitor.c 369969 
  /branches/1.8/apps/app_osplookup.c 369969 
  /branches/1.8/apps/app_sms.c 369969 
  /branches/1.8/apps/app_voicemail.c 369969 
  /branches/1.8/apps/app_while.c 369969 
  /branches/1.8/cdr/cdr_pgsql.c 369969 
  /branches/1.8/channels/chan_alsa.c 369969 
  /branches/1.8/channels/chan_gtalk.c 369969 
  /branches/1.8/channels/chan_iax2.c 369969 
  /branches/1.8/channels/chan_jingle.c 369969 
  /branches/1.8/channels/chan_sip.c 369969 
  /branches/1.8/funcs/func_channel.c 369969 
  /branches/1.8/funcs/func_cut.c 369969 
  /branches/1.8/funcs/func_global.c 369969 
  /branches/1.8/funcs/func_logic.c 369969 
  /branches/1.8/funcs/func_strings.c 369969 
  /branches/1.8/include/asterisk/strings.h 369969 
  /branches/1.8/include/asterisk/utils.h 369969 
  /branches/1.8/main/app.c 369969 
  /branches/1.8/main/asterisk.c 369969 
  /branches/1.8/main/astmm.c 369969 
  /branches/1.8/main/callerid.c 369969 
  /branches/1.8/main/channel.c 369969 
  /branches/1.8/main/config.c 369969 
  /branches/1.8/main/dsp.c 369969 
  /branches/1.8/main/event.c 369969 
  /branches/1.8/main/features.c 369969 
  /branches/1.8/main/file.c 369969 
  /branches/1.8/main/http.c 369969 
  /branches/1.8/main/logger.c 369969 
  /branches/1.8/main/manager.c 369969 
  /branches/1.8/main/pbx.c 369969 
  /branches/1.8/main/say.c 369969 
  /branches/1.8/main/strcompat.c 369969 
  /branches/1.8/main/tcptls.c 369969 
  /branches/1.8/main/threadstorage.c 369969 
  /branches/1.8/main/utils.c 369969 
  /branches/1.8/pbx/pbx_ael.c 369969 
  /branches/1.8/pbx/pbx_dundi.c 369969 
  /branches/1.8/pbx/pbx_lua.c 369969 
  /branches/1.8/pbx/pbx_realtime.c 369969 
  /branches/1.8/pbx/pbx_spool.c 369969 
  /branches/1.8/res/ael/pval.c 369969 
  /branches/1.8/res/res_agi.c 369969 
  /branches/1.8/res/res_config_pgsql.c 369969 
  /branches/1.8/res/res_jabber.c 369969 
  /branches/1.8/tests/test_linkedlists.c 369969 
  /branches/1.8/utils/extconf.c 369969 

Diff: https://reviewboard.asterisk.org/r/2032/diff


Testing
-------

It compiles.


Thanks,

wdoekes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120712/9f718984/attachment-0001.htm>


More information about the asterisk-dev mailing list