From d16c3fd4ca7637d33efa163106630a4110f7a448 Mon Sep 17 00:00:00 2001 From: jpeeler Date: Wed, 11 Mar 2009 03:25:04 +0000 Subject: Fix malloc debug macros to work properly with h323. The main problem here was that cstdlib was undefining free thereby causing the proper debug macros to not be used. ast_h323.cxx has been changed to call ast_free instead to avoid the issue. Because using the ast prefix calls are a better choice, ast_free_ptr is the new wrapper for free to pass to functions. Also, a little bit of clean up was done to avoid the debug macros intentionally being redefined. (closes issue #13593) Reported by: pj git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@181133 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx/pbx_ael.c | 4 ++-- pbx/pbx_config.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'pbx') diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index 7eb3dc06c..655d09632 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -4079,7 +4079,7 @@ void add_extensions(struct ael_extension *exten) pbx_substitute_variables_helper(NULL, exten->name, realext, sizeof(realext) - 1); if (exten->hints) { if (ast_add_extension2(exten->context, 0 /*no replace*/, realext, PRIORITY_HINT, NULL, exten->cidmatch, - exten->hints, NULL, ast_free, registrar)) { + exten->hints, NULL, ast_free_ptr, registrar)) { ast_log(LOG_WARNING, "Unable to add step at priority 'hint' of extension '%s'\n", exten->name); } @@ -4159,7 +4159,7 @@ void add_extensions(struct ael_extension *exten) label = 0; if (ast_add_extension2(exten->context, 0 /*no replace*/, realext, pr->priority_num, (label?label:NULL), exten->cidmatch, - app, strdup(appargs), ast_free, registrar)) { + app, strdup(appargs), ast_free_ptr, registrar)) { ast_log(LOG_WARNING, "Unable to add step at priority '%d' of extension '%s'\n", pr->priority_num, exten->name); } diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index ad3c86abe..c99c2983b 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1536,7 +1536,7 @@ static int handle_context_add_extension_deprecated(int fd, int argc, char *argv[ if (!app_data) app_data=""; if (ast_add_extension(argv[4], argc == 6 ? 1 : 0, exten, iprior, NULL, cidmatch, app, - (void *)strdup(app_data), ast_free, registrar)) { + (void *)strdup(app_data), ast_free_ptr, registrar)) { switch (errno) { case ENOMEM: ast_cli(fd, "Out of free memory\n"); @@ -1629,7 +1629,7 @@ static int handle_context_add_extension(int fd, int argc, char *argv[]) if (!app_data) app_data=""; if (ast_add_extension(argv[5], argc == 7 ? 1 : 0, exten, iprior, NULL, cidmatch, app, - (void *)strdup(app_data), ast_free, registrar)) { + (void *)strdup(app_data), ast_free_ptr, registrar)) { switch (errno) { case ENOMEM: ast_cli(fd, "Out of free memory\n"); @@ -2372,7 +2372,7 @@ static int pbx_load_config(const char *config_file) lastpri = ipri; if (!ast_opt_dont_warn && !strcmp(realext, "_.")) ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno); - if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free, registrar)) { + if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), ast_free_ptr, registrar)) { ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno); } } @@ -2516,9 +2516,9 @@ static void pbx_load_users(void) /* If voicemail, use "stdexten" else use plain old dial */ if (hasvoicemail) { snprintf(tmp, sizeof(tmp), "stdexten|%s|${HINT}", cat); - ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", strdup(tmp), ast_free, registrar); + ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", strdup(tmp), ast_free_ptr, registrar); } else { - ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free, registrar); + ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar); } } } -- cgit v1.2.3