From 64b640a6f79d3f9120f2f05463f26ec881d085be Mon Sep 17 00:00:00 2001 From: murf Date: Tue, 18 Mar 2008 14:09:50 +0000 Subject: Merged revisions 109309 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r109309 | murf | 2008-03-18 00:37:15 -0600 (Tue, 18 Mar 2008) | 17 lines (closes issue #11903) Reported by: atis Many thanks to atis for spotting this problem and reporting it. The fix was to straighten out how items are placed on and removed from the file stack. Regressions as well as the provided test case helped to straighten out all code paths. valgrind was used to make sure all memory allocated was freed. Sorry for not solving this earlier. I got distracted. Added the ntest23 regression test, which is mainly a copy of ntest22, but with a few juicy errors thrown in, to replicate the kind of error that atis spotted. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@109357 f38db490-d61c-443f-a65b-d21fe96a405b --- utils/ael_main.c | 4 ++-- utils/conf2ael.c | 4 ++-- utils/extconf.c | 12 +++++------- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'utils') diff --git a/utils/ael_main.c b/utils/ael_main.c index 24349b457..74a432fa9 100644 --- a/utils/ael_main.c +++ b/utils/ael_main.c @@ -97,7 +97,7 @@ int ast_add_extension2(struct ast_context *con, const char *registrar); void pbx_builtin_setvar(void *chan, void *data); struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar); -struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar); +struct ast_context * ast_context_find_or_create(void **extcontexts, void *tab, const char *name, const char *registrar); void ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar); void ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar); void ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar); @@ -361,7 +361,7 @@ struct ast_context * ast_context_create(void **extcontexts, const char *name, co return x; } -struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar) +struct ast_context * ast_context_find_or_create(void **extcontexts, void *tab, const char *name, const char *registrar) { struct ast_context *x = calloc(1, sizeof(*x)); if (!x) diff --git a/utils/conf2ael.c b/utils/conf2ael.c index 56856efbf..c69486a33 100644 --- a/utils/conf2ael.c +++ b/utils/conf2ael.c @@ -610,7 +610,7 @@ struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, { printf("find/Creating context %s, registrar=%s\n", name, registrar); - return localized_context_create(extcontexts, name, registrar); + return localized_context_find_or_create(extcontexts, exttable, name, registrar); } void ast_cli_register_multiple(void); @@ -657,7 +657,7 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar) { - localized_merge_contexts_and_delete(extcontexts, registrar); + localized_merge_contexts_and_delete(extcontexts, exttable, registrar); } struct ast_exten *pbx_find_extension(struct ast_channel *chan, diff --git a/utils/extconf.c b/utils/extconf.c index 9903ff295..4ff6e1dc0 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -5520,20 +5520,18 @@ static int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *c return pbx_extension_helper(c, con, NULL, exten, 0, label, callerid, E_FINDLABEL); } -static struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar) +static struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar) { return __ast_context_create(extcontexts, name, registrar, 1); } -struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar); - -struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar) +struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar); +struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar) { - return __ast_context_create(extcontexts, name, registrar, 0); + return __ast_context_create(extcontexts, name, registrar, 1); } - /* chopped this one off at the knees */ static int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len) { @@ -5916,7 +5914,7 @@ static int pbx_load_config(const char *config_file) /* All categories but "general" or "globals" are considered contexts */ if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals")) continue; - con=ast_context_find_or_create(&local_contexts,cxt, registrar); + con=ast_context_find_or_create(&local_contexts,NULL,cxt, registrar); if (con == NULL) continue; -- cgit v1.2.3