mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-27 16:07:15 -07:00
Memory leaks fix
(closes ASTERISK-22376)
Reported by: John Hardin
Patches:
memleak.patch uploaded by jhardin (license 6512)
memleak2.patch uploaded by jhardin (license 6512)
........
Merged revisions 397946 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3001,6 +3001,8 @@ static void app_cleanup(void)
|
||||
mwi_topic_pool = NULL;
|
||||
ao2_cleanup(mwi_topic_all);
|
||||
mwi_topic_all = NULL;
|
||||
ao2_cleanup(mwi_state_cache);
|
||||
mwi_state_cache = NULL;
|
||||
mwi_topic_cached = stasis_caching_unsubscribe_and_join(mwi_topic_cached);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_state_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_mwi_vm_app_type);
|
||||
|
||||
+3
-1
@@ -1921,7 +1921,7 @@ static int can_safely_quit(shutdown_nice_t niceness, int restart)
|
||||
static void really_quit(int num, shutdown_nice_t niceness, int restart)
|
||||
{
|
||||
int active_channels;
|
||||
RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
|
||||
struct ast_json *json_object = NULL;
|
||||
int run_cleanups = niceness >= SHUTDOWN_NICE;
|
||||
|
||||
if (run_cleanups) {
|
||||
@@ -1959,6 +1959,8 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
|
||||
"Shutdown", active_channels ? "Uncleanly" : "Cleanly",
|
||||
"Restart", restart ? "True" : "False");
|
||||
ast_manager_publish_event("Shutdown", EVENT_FLAG_SYSTEM, json_object);
|
||||
ast_json_unref(json_object);
|
||||
json_object = NULL;
|
||||
}
|
||||
ast_verb(0, "Asterisk %s ending (%d).\n",
|
||||
active_channels ? "uncleanly" : "cleanly", num);
|
||||
|
||||
+3
-1
@@ -1799,7 +1799,7 @@ static int finalized_state_process_party_a(struct cdr_object *cdr, struct ast_ch
|
||||
static void handle_dial_message(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
|
||||
{
|
||||
RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
|
||||
struct cdr_object *cdr;
|
||||
RAII_VAR(struct cdr_object *, cdr, NULL, ao2_cleanup);
|
||||
struct ast_multi_channel_blob *payload = stasis_message_data(message);
|
||||
struct ast_channel_snapshot *caller;
|
||||
struct ast_channel_snapshot *peer;
|
||||
@@ -3967,6 +3967,8 @@ static void cdr_engine_cleanup(void)
|
||||
bridge_subscription = stasis_unsubscribe_and_join(bridge_subscription);
|
||||
parking_subscription = stasis_unsubscribe_and_join(parking_subscription);
|
||||
stasis_message_router_unsubscribe_and_join(stasis_router);
|
||||
ao2_cleanup(cdr_topic);
|
||||
cdr_topic = NULL;
|
||||
}
|
||||
|
||||
static void cdr_engine_shutdown(void)
|
||||
|
||||
@@ -1352,6 +1352,8 @@ static void ast_cel_engine_term(void)
|
||||
cel_dialstatus_store = NULL;
|
||||
ao2_cleanup(linkedids);
|
||||
linkedids = NULL;
|
||||
ao2_cleanup(cel_backends);
|
||||
cel_backends = NULL;
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(cel_generic_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -457,9 +457,11 @@ static int process_category(struct ast_config *cfg, struct aco_info *info, struc
|
||||
if (!ast_strlen_zero(file->skip_category)) {
|
||||
regex_skip = build_regex(file->skip_category);
|
||||
if (!regexec(regex_skip, cat, 0, NULL, 0)) {
|
||||
regfree(regex_skip);
|
||||
ast_free(regex_skip);
|
||||
return 0;
|
||||
}
|
||||
regfree(regex_skip);
|
||||
ast_free(regex_skip);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -75,9 +75,9 @@ STASIS_MESSAGE_TYPE_DEFN(ast_format_unregister_type);
|
||||
static struct ast_json *json_array_from_list(const char *list, const char *sep)
|
||||
{
|
||||
RAII_VAR(struct ast_json *, array, ast_json_array_create(), ast_json_unref);
|
||||
RAII_VAR(char *, stringp, ast_strdup(list), ast_free);
|
||||
char *ext;
|
||||
char *stringp, *ext;
|
||||
|
||||
stringp = ast_strdupa(list); /* this is in the stack so does not need to be freed */
|
||||
if (!array || !stringp) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -7755,6 +7755,8 @@ static void manager_shutdown(void)
|
||||
stasis_message_router_unsubscribe_and_join(stasis_router);
|
||||
stasis_router = NULL;
|
||||
}
|
||||
stasis_unsubscribe_and_join(rtp_topic_forwarder);
|
||||
rtp_topic_forwarder = NULL;
|
||||
ao2_cleanup(manager_topic);
|
||||
manager_topic = NULL;
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(ast_manager_get_generic_type);
|
||||
|
||||
@@ -172,6 +172,7 @@ static int process_config(int reload)
|
||||
static void config_exit(void)
|
||||
{
|
||||
aco_info_destroy(&cfg_info);
|
||||
ao2_global_obj_release(confs);
|
||||
}
|
||||
|
||||
int stasis_config_init(void)
|
||||
|
||||
Reference in New Issue
Block a user