aboutsummaryrefslogtreecommitdiffstats
path: root/main/features.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-02 04:51:29 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-02 04:51:29 +0000
commit54e8c057c8660ec6fcc9039286ddea4a01df4ce0 (patch)
tree3e0c622f990675ca7a9145d76937c9d1c64684a0 /main/features.c
parentce466967683875f1033ffb0e3a5bcbd18131ad2f (diff)
(closes issue #13202)
Reported by: falves11 Tested by: murf falves11 == The changes I introduce here seem to clear up the problem for me. However, if they do not for you, please reopen this bug, and we'll keep digging. The root of this problem seems to be a subtle memory corruption introduced when creating an extension with an empty extension name. While valgrind cannot detect it outside of DEBUG_MALLOC mode, when compiled with DEBUG_MALLOC, this is certain death. The code in main/features.c is a puzzle to me. On the initial module load, the code is attempting to add the parking extension before the features.conf file has even been opened! I just wrapped the offending call with an if() that will not try to add the extension if the extension name is empty. THis seems to solve the corruption, and let the "memory show allocations" work as one would expect. But, really, adding an extension with an empty name is a seriously bad thing to allow, as it will mess up all the pattern matching algorithms, etc. So, I added a statement to the add_extension2 code to return a -1 if this is attempted. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135265 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/features.c')
-rw-r--r--main/features.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/features.c b/main/features.c
index 9724cc85c..f540c455b 100644
--- a/main/features.c
+++ b/main/features.c
@@ -2911,8 +2911,10 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
/* Add a parking extension into the context */
if (!oldparkinglot) {
- if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), ast_free, registrar) == -1)
- error = 1;
+ if (!ast_strlen_zero(ast_parking_ext())) {
+ if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), ast_free, registrar) == -1)
+ error = 1;
+ }
}
ao2_unlock(parkinglot);