diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-07-31 20:21:43 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-07-31 20:21:43 +0000 |
commit | 9b16c8b0f6c3b6310e303411421bfcb16b26c3c4 (patch) | |
tree | 273c31a834a21bd2239ec6b83cd35c602ea25d26 /main/event.c | |
parent | 6c23a60f802e7708389b1a6463a40dc0500512bd (diff) |
Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().
(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........
Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/event.c')
-rw-r--r-- | main/event.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/event.c b/main/event.c index 7470eaddd..23e20f333 100644 --- a/main/event.c +++ b/main/event.c @@ -480,7 +480,7 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ ie_type != AST_EVENT_IE_END; ie_type = va_arg(ap, enum ast_event_ie_type)) { - struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value)); + struct ast_event_ie_val *ie_value = ast_alloca(sizeof(*ie_value)); int insert = 0; memset(ie_value, 0, sizeof(*ie_value)); @@ -504,7 +504,7 @@ enum ast_event_subscriber_res ast_event_check_subscriber(enum ast_event_type typ void *data = va_arg(ap, void *); size_t datalen = va_arg(ap, size_t); - ie_value->payload.raw = alloca(datalen); + ie_value->payload.raw = ast_alloca(datalen); memcpy(ie_value->payload.raw, data, datalen); ie_value->raw_datalen = datalen; insert = 1; @@ -1157,7 +1157,7 @@ int ast_event_append_ie_str(struct ast_event **event, enum ast_event_ie_type ie_ size_t payload_len; payload_len = sizeof(*str_payload) + strlen(str); - str_payload = alloca(payload_len); + str_payload = ast_alloca(payload_len); strcpy(str_payload->str, str); if (ie_type == AST_EVENT_IE_DEVICE) { @@ -1229,7 +1229,7 @@ struct ast_event *ast_event_new(enum ast_event_type type, ...) ie_type != AST_EVENT_IE_END; ie_type = va_arg(ap, enum ast_event_ie_type)) { - struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value)); + struct ast_event_ie_val *ie_value = ast_alloca(sizeof(*ie_value)); int insert = 0; memset(ie_value, 0, sizeof(*ie_value)); @@ -1252,7 +1252,7 @@ struct ast_event *ast_event_new(enum ast_event_type type, ...) { void *data = va_arg(ap, void *); size_t datalen = va_arg(ap, size_t); - ie_value->payload.raw = alloca(datalen); + ie_value->payload.raw = ast_alloca(datalen); memcpy(ie_value->payload.raw, data, datalen); ie_value->raw_datalen = datalen; insert = 1; |