Coverity Report: Fix issues for error type REVERSE_INULL (core modules)

* Fixes findings: 0-2,5,7-15,24-26,28-31

(issue ASTERISK-19648)
Reported by: Matt Jordan
........

Merged revisions 368039 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 368042 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2012-05-31 18:39:30 +00:00
parent fdb002a43a
commit dd2427c141
11 changed files with 131 additions and 129 deletions

View File

@@ -1370,8 +1370,13 @@ static int unload_module(void)
static char *pbx_strsep(char **destructible, const char *delim)
{
int square = 0;
char *res = *destructible;
for (; destructible && *destructible && **destructible; (*destructible)++) {
char *res;
if (!destructible || !*destructible) {
return NULL;
}
res = *destructible;
for (; **destructible; (*destructible)++) {
if (**destructible == '[' && !strchr(delim, '[')) {
square++;
} else if (**destructible == ']' && !strchr(delim, ']')) {
@@ -1386,7 +1391,7 @@ static char *pbx_strsep(char **destructible, const char *delim)
break;
}
}
if (destructible && *destructible && **destructible == '\0') {
if (**destructible == '\0') {
*destructible = NULL;
}
return res;
@@ -1596,7 +1601,7 @@ process_extension:
v->lineno, vfile);
}
}
free(tc);
ast_free(tc);
} else if (!strcasecmp(v->name, "include")) {
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_include2(con, realvalue, registrar)) {