diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-05-10 20:56:09 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-05-10 20:56:09 +0000 |
commit | dd81b047dbf15a501b81354db505daf50703a1a0 (patch) | |
tree | 01754d4206c865653717baf23e47ed264f7a6b3d /main/pbx.c | |
parent | 8227f70cd70f497cb03c1f9aab63950bcd979d8b (diff) |
Resolve FORWARD_NULL static analysis warnings
This resolves core findings from ASTERISK-19650 numbers 0-2, 6, 7, 9-11, 14-20,
22-24, 28, 30-32, 34-36, 42-56, 82-84, 87, 89-90, 93-102, 104, 105, 109-111,
and 115. Finding numbers 26, 33, and 29 were already resolved. Those skipped
were either extended/deprecated or in areas of code that shouldn't be
disturbed.
(Closes issue ASTERISK-19650)
........
Merged revisions 366167 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 366168 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/main/pbx.c b/main/pbx.c index f04051ceb..7ea360024 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1733,8 +1733,9 @@ static void cli_match_char_tree(struct match_char *node, char *prefix, int fd) extenstr[0] = '\0'; - if (node && node->exten) + if (node->exten) { snprintf(extenstr, sizeof(extenstr), "(%p)", node->exten); + } if (strlen(node->x) > 1) { ast_cli(fd, "%s[%s]:%c:%c:%d:%s%s%s\n", prefix, node->x, node->is_pattern ? 'Y' : 'N', @@ -9705,6 +9706,11 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, const char *data) struct timeval tv = ast_tvnow(); long timesecs; + if (!chan) { + ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n"); + return -1; + } + if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?'labeliftrue':'labeliffalse'\n"); return -1; @@ -9712,17 +9718,16 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, const char *data) ts = s = ast_strdupa(data); - if (chan) { - ast_channel_lock(chan); - if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { - tv.tv_sec = timesecs; - } else if (ctime) { - ast_log(LOG_WARNING, "Using current time to evaluate\n"); - /* Reset when unparseable */ - pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); - } - ast_channel_unlock(chan); + ast_channel_lock(chan); + if ((ctime = pbx_builtin_getvar_helper(chan, "TESTTIME")) && sscanf(ctime, "%ld", ×ecs) == 1) { + tv.tv_sec = timesecs; + } else if (ctime) { + ast_log(LOG_WARNING, "Using current time to evaluate\n"); + /* Reset when unparseable */ + pbx_builtin_setvar_helper(chan, "TESTTIME", NULL); } + ast_channel_unlock(chan); + /* Separate the Goto path */ strsep(&ts, "?"); branch1 = strsep(&ts,":"); |