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/app.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/app.c')
-rw-r--r-- | main/app.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/main/app.c b/main/app.c index f6a3095d2..c8cb29c90 100644 --- a/main/app.c +++ b/main/app.c @@ -947,7 +947,7 @@ static int control_streamfile(struct ast_channel *chan, } if (blen > 2) { - breaks = alloca(blen + 1); + breaks = ast_alloca(blen + 1); breaks[0] = '\0'; if (stop) { strcat(breaks, stop); @@ -1719,8 +1719,8 @@ static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path) int lp = strlen(path); time_t start; - s = alloca(lp + 10); - fs = alloca(lp + 20); + s = ast_alloca(lp + 10); + fs = ast_alloca(lp + 20); snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random()); fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, AST_FILE_MODE); @@ -1752,7 +1752,7 @@ static int ast_unlock_path_lockfile(const char *path) char *s; int res; - s = alloca(strlen(path) + 10); + s = ast_alloca(strlen(path) + 10); snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock"); @@ -1793,7 +1793,7 @@ static enum AST_LOCK_RESULT ast_lock_path_flock(const char *path) struct path_lock *pl; struct stat st, ost; - fs = alloca(strlen(path) + 20); + fs = ast_alloca(strlen(path) + 20); snprintf(fs, strlen(path) + 19, "%s/lock", path); if (lstat(fs, &st) == 0) { @@ -1874,7 +1874,7 @@ static int ast_unlock_path_flock(const char *path) char *s; struct path_lock *p; - s = alloca(strlen(path) + 20); + s = ast_alloca(strlen(path) + 20); AST_LIST_LOCK(&path_lock_list); AST_LIST_TRAVERSE_SAFE_BEGIN(&path_lock_list, p, le) { |