summaryrefslogtreecommitdiff
path: root/pbx/pbx_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'pbx/pbx_config.c')
-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)) {