summaryrefslogtreecommitdiff
path: root/pbx
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-05-31 18:39:30 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-05-31 18:39:30 +0000
commitdd2427c1414d62cd7e3c867f17de9d6dbac844fe (patch)
tree5760fb673e236d0f58b094240de81ca9780cd135 /pbx
parentfdb002a43a819542693815767a0ca9aba135f18c (diff)
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
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_config.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 6ab54656a..cf9b26fe5 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -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)) {