[asterisk-commits] kharwell: trunk r397947 - in /trunk: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 29 16:37:31 CDT 2013


Author: kharwell
Date: Thu Aug 29 16:37:29 2013
New Revision: 397947

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397947
Log:
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

Modified:
    trunk/   (props changed)
    trunk/main/app.c
    trunk/main/asterisk.c
    trunk/main/cdr.c
    trunk/main/cel.c
    trunk/main/config_options.c
    trunk/main/file.c
    trunk/main/manager.c
    trunk/main/stasis_config.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Aug 29 16:37:29 2013
@@ -1,1 +1,1 @@
-/branches/12:1-397927,397938
+/branches/12:1-397927,397938,397946

Modified: trunk/main/app.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/app.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Thu Aug 29 16:37:29 2013
@@ -3001,6 +3001,8 @@
 	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);

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Thu Aug 29 16:37:29 2013
@@ -1921,7 +1921,7 @@
 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 @@
 				"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);

Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Thu Aug 29 16:37:29 2013
@@ -1799,7 +1799,7 @@
 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 @@
 	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)

Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Thu Aug 29 16:37:29 2013
@@ -1352,6 +1352,8 @@
 	cel_dialstatus_store = NULL;
 	ao2_cleanup(linkedids);
 	linkedids = NULL;
+	ao2_cleanup(cel_backends);
+	cel_backends = NULL;
 	STASIS_MESSAGE_TYPE_CLEANUP(cel_generic_type);
 }
 

Modified: trunk/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/config_options.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/config_options.c (original)
+++ trunk/main/config_options.c Thu Aug 29 16:37:29 2013
@@ -457,9 +457,11 @@
 	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);
 	}
 

Modified: trunk/main/file.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/file.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Thu Aug 29 16:37:29 2013
@@ -75,9 +75,9 @@
 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;
 	}

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Thu Aug 29 16:37:29 2013
@@ -7755,6 +7755,8 @@
 		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);

Modified: trunk/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_config.c?view=diff&rev=397947&r1=397946&r2=397947
==============================================================================
--- trunk/main/stasis_config.c (original)
+++ trunk/main/stasis_config.c Thu Aug 29 16:37:29 2013
@@ -172,6 +172,7 @@
 static void config_exit(void)
 {
 	aco_info_destroy(&cfg_info);
+	ao2_global_obj_release(confs);
 }
 
 int stasis_config_init(void)




More information about the asterisk-commits mailing list