[asterisk-commits] kharwell: branch 12 r397946 - /branches/12/main/

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


Author: kharwell
Date: Thu Aug 29 16:34:52 2013
New Revision: 397946

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

Modified:
    branches/12/main/app.c
    branches/12/main/asterisk.c
    branches/12/main/cdr.c
    branches/12/main/cel.c
    branches/12/main/config_options.c
    branches/12/main/file.c
    branches/12/main/manager.c
    branches/12/main/stasis_config.c

Modified: branches/12/main/app.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/app.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/app.c (original)
+++ branches/12/main/app.c Thu Aug 29 16:34:52 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: branches/12/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/asterisk.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/asterisk.c (original)
+++ branches/12/main/asterisk.c Thu Aug 29 16:34:52 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: branches/12/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/cdr.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/cdr.c (original)
+++ branches/12/main/cdr.c Thu Aug 29 16:34:52 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: branches/12/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/cel.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/cel.c (original)
+++ branches/12/main/cel.c Thu Aug 29 16:34:52 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: branches/12/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/config_options.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/config_options.c (original)
+++ branches/12/main/config_options.c Thu Aug 29 16:34:52 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: branches/12/main/file.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/file.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/file.c (original)
+++ branches/12/main/file.c Thu Aug 29 16:34:52 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: branches/12/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/manager.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/manager.c (original)
+++ branches/12/main/manager.c Thu Aug 29 16:34:52 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: branches/12/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/stasis_config.c?view=diff&rev=397946&r1=397945&r2=397946
==============================================================================
--- branches/12/main/stasis_config.c (original)
+++ branches/12/main/stasis_config.c Thu Aug 29 16:34:52 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