[asterisk-commits] sgriepentrog: branch 13 r431583 - in /branches/13: main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 6 15:26:21 CST 2015


Author: sgriepentrog
Date: Fri Feb  6 15:26:12 2015
New Revision: 431583

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431583
Log:
various: cleanup issues found during leak hunt

In this collection of small patches to prevent
Valgrind errors are: fixes for reference leaks
in config hooks, evaluating a parameter beyond
bounds, and accessing a structure after a lock
where it could have been already free'd.

Review: https://reviewboard.asterisk.org/r/4407/

Modified:
    branches/13/main/config.c
    branches/13/main/utils.c
    branches/13/res/res_pjsip.c

Modified: branches/13/main/config.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/config.c?view=diff&rev=431583&r1=431582&r2=431583
==============================================================================
--- branches/13/main/config.c (original)
+++ branches/13/main/config.c Fri Feb  6 15:26:12 2015
@@ -3821,6 +3821,9 @@
 	AST_LIST_UNLOCK(&cfmtime_head);
 
 	ast_cli_unregister_multiple(cli_config, ARRAY_LEN(cli_config));
+
+	ao2_cleanup(cfg_hooks);
+	cfg_hooks = NULL;
 }
 
 int register_config_cli(void)
@@ -3909,5 +3912,6 @@
 	hook->module = ast_strdup(module);
 
 	ao2_link(cfg_hooks, hook);
+	ao2_ref(hook, -1);
 	return 0;
 }

Modified: branches/13/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/utils.c?view=diff&rev=431583&r1=431582&r2=431583
==============================================================================
--- branches/13/main/utils.c (original)
+++ branches/13/main/utils.c Fri Feb  6 15:26:12 2015
@@ -1856,7 +1856,7 @@
 	/* Join words into a string */
 	if (!s)
 		return;
-	for (x = 0; ofs < len && w[x] && x < size; x++) {
+	for (x = 0; ofs < len && x < size && w[x] ; x++) {
 		if (x > 0)
 			s[ofs++] = delim;
 		for (src = w[x]; *src && ofs < len; src++)

Modified: branches/13/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip.c?view=diff&rev=431583&r1=431582&r2=431583
==============================================================================
--- branches/13/res/res_pjsip.c (original)
+++ branches/13/res/res_pjsip.c Fri Feb  6 15:26:12 2015
@@ -2965,13 +2965,16 @@
 static int sync_task(void *data)
 {
 	struct sync_task_data *std = data;
+	int ret;
+
 	std->fail = std->task(std->task_data);
 
 	ast_mutex_lock(&std->lock);
 	std->complete = 1;
 	ast_cond_signal(&std->cond);
+	ret = std->fail;
 	ast_mutex_unlock(&std->lock);
-	return std->fail;
+	return ret;
 }
 
 int ast_sip_push_task_synchronous(struct ast_taskprocessor *serializer, int (*sip_task)(void *), void *task_data)




More information about the asterisk-commits mailing list