Make the MALLOC_DEBUG output for free() useful again. After changing calls to
free to be ast_free, astmm said all calls to free were coming from utils.h git-svn-id: http://svn.digium.com/svn/asterisk/trunk@82628 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
a8a0589de9
commit
eb015e768e
|
@ -1970,7 +1970,7 @@ static int load_module(void)
|
|||
if (!con)
|
||||
ast_log(LOG_ERROR, "Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n");
|
||||
else
|
||||
ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free, "app_dial");
|
||||
ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_dial");
|
||||
|
||||
res = ast_register_application(app, dial_exec, synopsis, descrip);
|
||||
res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
|
||||
|
|
|
@ -4715,7 +4715,7 @@ static int sla_build_trunk(struct ast_config *cfg, const char *cat)
|
|||
return -1;
|
||||
}
|
||||
if (ast_add_extension2(context, 0 /* don't replace */, "s", 1,
|
||||
NULL, NULL, slatrunk_app, ast_strdup(trunk->name), ast_free, sla_registrar)) {
|
||||
NULL, NULL, slatrunk_app, ast_strdup(trunk->name), ast_free_ptr, sla_registrar)) {
|
||||
ast_log(LOG_ERROR, "Failed to automatically create extension "
|
||||
"for trunk '%s'!\n", trunk->name);
|
||||
destroy_trunk(trunk);
|
||||
|
@ -4854,7 +4854,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
|
|||
/* The extension for when the handset goes off-hook.
|
||||
* exten => station1,1,SLAStation(station1) */
|
||||
if (ast_add_extension2(context, 0 /* don't replace */, station->name, 1,
|
||||
NULL, NULL, slastation_app, ast_strdup(station->name), ast_free, sla_registrar)) {
|
||||
NULL, NULL, slastation_app, ast_strdup(station->name), ast_free_ptr, sla_registrar)) {
|
||||
ast_log(LOG_ERROR, "Failed to automatically create extension "
|
||||
"for trunk '%s'!\n", station->name);
|
||||
destroy_station(station);
|
||||
|
@ -4869,7 +4869,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
|
|||
/* Extension for this line button
|
||||
* exten => station1_line1,1,SLAStation(station1_line1) */
|
||||
if (ast_add_extension2(context, 0 /* don't replace */, exten, 1,
|
||||
NULL, NULL, slastation_app, ast_strdup(exten), ast_free, sla_registrar)) {
|
||||
NULL, NULL, slastation_app, ast_strdup(exten), ast_free_ptr, sla_registrar)) {
|
||||
ast_log(LOG_ERROR, "Failed to automatically create extension "
|
||||
"for trunk '%s'!\n", station->name);
|
||||
destroy_station(station);
|
||||
|
|
|
@ -4979,7 +4979,7 @@ static int load_module(void)
|
|||
if (!con)
|
||||
ast_log(LOG_ERROR, "Queue virtual context 'app_queue_gosub_virtual_context' does not exist and unable to create\n");
|
||||
else
|
||||
ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free, "app_queue");
|
||||
ast_add_extension2(con, 1, "s", 1, NULL, NULL, "KeepAlive", ast_strdup(""), ast_free_ptr, "app_queue");
|
||||
|
||||
if (queue_persistent_members)
|
||||
reload_queue_members();
|
||||
|
|
|
@ -6057,7 +6057,7 @@ static void register_peer_exten(struct iax2_peer *peer, int onoff)
|
|||
if (onoff) {
|
||||
if (!ast_exists_extension(NULL, regcontext, ext, 1, NULL))
|
||||
ast_add_extension(regcontext, 1, ext, 1, NULL, NULL,
|
||||
"Noop", ast_strdup(peer->name), ast_free, "IAX2");
|
||||
"Noop", ast_strdup(peer->name), ast_free_ptr, "IAX2");
|
||||
} else
|
||||
ast_context_remove_extension(regcontext, ext, 1, NULL);
|
||||
}
|
||||
|
|
|
@ -2906,7 +2906,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
|
|||
}
|
||||
if (onoff)
|
||||
ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop",
|
||||
ast_strdup(peer->name), ast_free, "SIP");
|
||||
ast_strdup(peer->name), ast_free_ptr, "SIP");
|
||||
else
|
||||
ast_context_remove_extension(context, ext, 1, NULL);
|
||||
}
|
||||
|
|
|
@ -1628,7 +1628,7 @@ static void register_exten(struct skinny_line *l)
|
|||
context = regcontext;
|
||||
}
|
||||
ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop",
|
||||
ast_strdup(l->name), ast_free, "Skinny");
|
||||
ast_strdup(l->name), ast_free_ptr, "Skinny");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -408,20 +408,22 @@ char *ast_process_quotes_and_slashes(char *start, char find, char replace_with);
|
|||
|
||||
long int ast_random(void);
|
||||
|
||||
#define ast_free free
|
||||
|
||||
/*!
|
||||
* \brief free() wrapper
|
||||
*
|
||||
* ast_free should be used when a function pointer for free() needs to be passed
|
||||
* ast_free_ptr should be used when a function pointer for free() needs to be passed
|
||||
* as the argument to a function. Otherwise, astmm will cause seg faults.
|
||||
*/
|
||||
#ifdef __AST_DEBUG_MALLOC
|
||||
static void ast_free(void *ptr) attribute_unused;
|
||||
static void ast_free(void *ptr)
|
||||
static void ast_free_ptr(void *ptr) attribute_unused;
|
||||
static void ast_free_ptr(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
ast_free(ptr);
|
||||
}
|
||||
#else
|
||||
#define ast_free free
|
||||
#define ast_free_ptr ast_free
|
||||
#endif
|
||||
|
||||
#ifndef __AST_DEBUG_MALLOC
|
||||
|
|
|
@ -1439,7 +1439,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);
|
||||
}
|
||||
}
|
||||
|
@ -1567,9 +1567,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#ifdef AAL_ARGCHECK
|
||||
#include "asterisk/argdesc.h"
|
||||
#endif
|
||||
#include "asterisk/utils.h"
|
||||
|
||||
extern int localized_pbx_load_module(void);
|
||||
|
||||
|
@ -3702,7 +3703,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);
|
||||
}
|
||||
|
@ -3782,7 +3783,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);
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
|
|||
ast_clear_flag(peer, AST_FLAG_MASQ_NOSTREAM);
|
||||
}
|
||||
if (con) {
|
||||
if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, ast_strdup(pu->parkingexten), ast_free, registrar))
|
||||
if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, ast_strdup(pu->parkingexten), ast_free_ptr, registrar))
|
||||
notify_metermaids(pu->parkingexten, parking_con, AST_DEVICE_INUSE);
|
||||
}
|
||||
if (pu->notquiteyet) {
|
||||
|
@ -2091,7 +2091,7 @@ static void *do_parking_thread(void *ignore)
|
|||
if (con) {
|
||||
char returnexten[AST_MAX_EXTENSION];
|
||||
snprintf(returnexten, sizeof(returnexten), "%s,,t", peername);
|
||||
ast_add_extension2(con, 1, peername, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free, registrar);
|
||||
ast_add_extension2(con, 1, peername, 1, NULL, NULL, "Dial", ast_strdup(returnexten), ast_free_ptr, registrar);
|
||||
}
|
||||
if (comebacktoorigin) {
|
||||
set_c_e_p(chan, parking_con_dial, peername, 1);
|
||||
|
|
Reference in New Issue