- The recent change to linklists.h broke the build on linux for some reason.
So, I have removed all of the uses of AST_LIST_HEAD_INIT and replaced them with the equivalent static initializations. - On passing, fix a memory leak in the unload_module() function of chan_agent. The agents list mutex was never destroyed, and the elements in the agents list were not freed. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@26990 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
d681ea8598
commit
da3cf563ba
|
@ -258,14 +258,14 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||||
FILE *child_commands = NULL;
|
FILE *child_commands = NULL;
|
||||||
FILE *child_errors = NULL;
|
FILE *child_errors = NULL;
|
||||||
FILE *child_events = NULL;
|
FILE *child_events = NULL;
|
||||||
struct ivr_localuser foo, *u = &foo;
|
struct ivr_localuser foo = {
|
||||||
|
.playlist = AST_LIST_HEAD_INIT_VALUE,
|
||||||
bzero(u, sizeof(*u));
|
.finishlist = AST_LIST_HEAD_INIT_VALUE,
|
||||||
|
};
|
||||||
|
struct ivr_localuser *u = &foo;
|
||||||
|
|
||||||
LOCAL_USER_ADD(lu);
|
LOCAL_USER_ADD(lu);
|
||||||
|
|
||||||
AST_LIST_HEAD_INIT(&u->playlist);
|
|
||||||
AST_LIST_HEAD_INIT(&u->finishlist);
|
|
||||||
u->abort_current_sound = 0;
|
u->abort_current_sound = 0;
|
||||||
u->chan = chan;
|
u->chan = chan;
|
||||||
|
|
||||||
|
|
|
@ -2597,19 +2597,16 @@ static int unload_module(void *mod)
|
||||||
ast_manager_unregister("AgentLogoff");
|
ast_manager_unregister("AgentLogoff");
|
||||||
ast_manager_unregister("AgentCallbackLogin");
|
ast_manager_unregister("AgentCallbackLogin");
|
||||||
/* Unregister channel */
|
/* Unregister channel */
|
||||||
ast_channel_unregister(&agent_tech);
|
AST_LIST_LOCK(&agents);
|
||||||
if (!AST_LIST_LOCK(&agents)) {
|
/* Hangup all interfaces if they have an owner */
|
||||||
/* Hangup all interfaces if they have an owner */
|
while ((p = AST_LIST_REMOVE_HEAD(&agents, list))) {
|
||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
if (p->owner)
|
||||||
if (p->owner)
|
ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
|
||||||
ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
|
free(p);
|
||||||
}
|
|
||||||
AST_LIST_UNLOCK(&agents);
|
|
||||||
AST_LIST_HEAD_INIT(&agents);
|
|
||||||
} else {
|
|
||||||
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
AST_LIST_UNLOCK(&agents);
|
||||||
|
AST_LIST_HEAD_DESTROY(&agents);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
dnsmgr.c
3
dnsmgr.c
|
@ -58,7 +58,7 @@ struct ast_dnsmgr_entry {
|
||||||
char name[1];
|
char name[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
static AST_LIST_HEAD(entry_list, ast_dnsmgr_entry) entry_list;
|
static AST_LIST_HEAD_STATIC(entry_list, ast_dnsmgr_entry);
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(refresh_lock);
|
AST_MUTEX_DEFINE_STATIC(refresh_lock);
|
||||||
|
|
||||||
|
@ -285,7 +285,6 @@ int dnsmgr_init(void)
|
||||||
ast_log(LOG_ERROR, "Unable to create schedule context.\n");
|
ast_log(LOG_ERROR, "Unable to create schedule context.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
AST_LIST_HEAD_INIT(&entry_list);
|
|
||||||
ast_cli_register(&cli_reload);
|
ast_cli_register(&cli_reload);
|
||||||
ast_cli_register(&cli_status);
|
ast_cli_register(&cli_status);
|
||||||
return do_reload(1);
|
return do_reload(1);
|
||||||
|
|
|
@ -353,20 +353,6 @@ struct { \
|
||||||
*/
|
*/
|
||||||
#define AST_LIST_TRAVERSE_SAFE_END }
|
#define AST_LIST_TRAVERSE_SAFE_END }
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Initializes a list head structure.
|
|
||||||
\param head This is a pointer to the list head structure
|
|
||||||
|
|
||||||
This macro initializes a list head structure by setting the head
|
|
||||||
entry to \a NULL (empty list) and recreating the embedded lock.
|
|
||||||
*/
|
|
||||||
#define AST_LIST_HEAD_INIT(head) { \
|
|
||||||
(head)->first = NULL; \
|
|
||||||
(head)->last = NULL; \
|
|
||||||
(head)->lock = AST_MUTEX_INIT_VALUE; \
|
|
||||||
ast_mutex_init(&(head)->lock); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Destroys a list head structure.
|
\brief Destroys a list head structure.
|
||||||
\param head This is a pointer to the list head structure
|
\param head This is a pointer to the list head structure
|
||||||
|
|
4
pbx.c
4
pbx.c
|
@ -3465,15 +3465,13 @@ AST_LIST_HEAD(store_hints, store_hint);
|
||||||
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
|
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
|
||||||
{
|
{
|
||||||
struct ast_context *tmp, *lasttmp = NULL;
|
struct ast_context *tmp, *lasttmp = NULL;
|
||||||
struct store_hints store;
|
struct store_hints store = AST_LIST_HEAD_INIT_VALUE;
|
||||||
struct store_hint *this;
|
struct store_hint *this;
|
||||||
struct ast_hint *hint;
|
struct ast_hint *hint;
|
||||||
struct ast_exten *exten;
|
struct ast_exten *exten;
|
||||||
int length;
|
int length;
|
||||||
struct ast_state_cb *thiscb, *prevcb;
|
struct ast_state_cb *thiscb, *prevcb;
|
||||||
|
|
||||||
AST_LIST_HEAD_INIT(&store);
|
|
||||||
|
|
||||||
/* it is very important that this function hold the hint list lock _and_ the conlock
|
/* it is very important that this function hold the hint list lock _and_ the conlock
|
||||||
during its operation; not only do we need to ensure that the list of contexts
|
during its operation; not only do we need to ensure that the list of contexts
|
||||||
and extensions does not change, but also that no hint callbacks (watchers) are
|
and extensions does not change, but also that no hint callbacks (watchers) are
|
||||||
|
|
|
@ -782,7 +782,7 @@ struct ast_call_feature builtin_features[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static AST_LIST_HEAD(feature_list,ast_call_feature) feature_list;
|
static AST_LIST_HEAD_STATIC(feature_list,ast_call_feature);
|
||||||
|
|
||||||
/*! \brief register new feature into feature_list*/
|
/*! \brief register new feature into feature_list*/
|
||||||
void ast_register_feature(struct ast_call_feature *feature)
|
void ast_register_feature(struct ast_call_feature *feature)
|
||||||
|
@ -2104,7 +2104,6 @@ static int load_module(void *mod)
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
__mod_desc = mod;
|
__mod_desc = mod;
|
||||||
AST_LIST_HEAD_INIT(&feature_list);
|
|
||||||
memset(parking_ext, 0, sizeof(parking_ext));
|
memset(parking_ext, 0, sizeof(parking_ext));
|
||||||
memset(parking_con, 0, sizeof(parking_con));
|
memset(parking_con, 0, sizeof(parking_con));
|
||||||
|
|
||||||
|
|
Reference in New Issue