[Commits] [SCM] claws branch, master, updated. 3.15.0-102-gb777073

ticho at claws-mail.org ticho at claws-mail.org
Wed Jul 12 13:31:40 CEST 2017


The branch, master has been updated
       via  b77707343f62ed124c5481d013181be90fca84a0 (commit)
      from  fb0fb9d311c6d716111c11dc5f8684ccaef9e3fe (commit)

Summary of changes:
 src/ldapctrl.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit b77707343f62ed124c5481d013181be90fca84a0
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Wed Jul 12 13:22:52 2017 +0200

    Fixed a few memory leaks in LDAP search results handling.

diff --git a/src/ldapctrl.c b/src/ldapctrl.c
index d830279..62adf5b 100644
--- a/src/ldapctrl.c
+++ b/src/ldapctrl.c
@@ -629,15 +629,18 @@ char **ldapctl_full_attribute_array( LdapControl *ctl ) {
 	}
 
 	def = ldapctl_get_default_criteria_list();
+	node = def;
 	
-	while (def) {
+	while (node) {
 		if( g_list_find_custom(tmp, (gpointer)def->data, 
 				(GCompareFunc)strcmp2) == NULL) {
-			tmp = g_list_append(tmp, g_strdup(def->data));
+			tmp = g_list_append(tmp, g_strdup(node->data));
 		}
-		def = def->next;
+		node = node->next;
 	}
 
+	g_list_free_full(def, g_free);
+
 	node = tmp;
 	cnt = g_list_length( tmp );
 	ptrArray = g_new0( char *, 1 + cnt);
@@ -660,6 +663,7 @@ void ldapctl_free_attribute_array( char **ptrArray ) {
 
 	/* Clear array to NULL's */
 	for( i = 0; ptrArray[i] != NULL; i++ ) {
+		g_free(ptrArray[i]);
 		ptrArray[i] = NULL;
 	}
 	g_free( ptrArray );
@@ -747,8 +751,7 @@ GList *ldapctl_get_default_criteria_list() {
 		else
 			item = g_strdup(criteria);
 		debug_print("adding attribute to list: %s\n", item);
-		attr_list = g_list_append(attr_list, g_strdup(item));
-		g_free(item);
+		attr_list = g_list_append(attr_list, item);
 	}
 	g_strfreev(c_list);
 	return attr_list;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list