summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2014-10-14 20:46:31 +0000
committerGeorge Joseph <george.joseph@fairview5.com>2014-10-14 20:46:31 +0000
commit54a5b8798f530915d6e6a52d71fe1ac3a2633c5a (patch)
tree7887241a97e8ef4775d74443ace2de2c42655a56 /main/config.c
parent2d07283dc5502f6521199aa4b6d1845a157afd4f (diff)
config: Fix SEGV in unit test with MALLOC_DEBUG
With MALLOC_DEBUG the /main/config config_basic_ops test was causing a SEGV while doing an ast_category_delete in an ast_category_browse loop. Apparently this never worked but was also never tested. I removed the test, added 2 notes to config.h indicating that it's not supported and added a few lines of code to ast_category_delete to prevent the SEGV should someone attempt it in the future. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4078/ ........ Merged revisions 425525 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@425526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c
index 7009e7d08..7e6a4d1c1 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1336,6 +1336,10 @@ struct ast_category *ast_category_delete(struct ast_config *config,
prev = category->prev;
+ if (config->last_browse == category) {
+ config->last_browse = prev;
+ }
+
ast_category_destroy(category);
return prev;