[sylpheed:31962] [PATCH] Sylpheed 2.4.7 memory leak in LDAP

Michael Schwendt mschwendt at gmail.com
Tue Dec 11 22:35:27 JST 2007


---------- Forwarded message ----------
From: Michael Schwendt
Date: 1 Nov 2007 22:08
Subject: Re: Sylpheed 2.4.7 segfault in LDAP search
To: Hiroyuki Yamamoto


In syldap.c, function syldap_search(), in the  "/* Process all
attributes */" loop, why is only the last "attribute" pointer freed
with ldap_memfree() after the loop is done? As I understand it, both
ldap_first_attribute() and ldap_next_attribute() return a dynamically
allocated array of char every time (or NULL), which ought to be freed
after each iteration of the loop. IMO:

--- syldap.c~   2006-08-31 10:21:21.000000000 +0200
+++ syldap.c    2007-11-01 22:05:29.000000000 +0100
@@ -602,11 +602,10 @@
                        if( g_ascii_strcasecmp( attribute,
SYLDAP_ATTR_DN ) == 0 ) {
                                listDN = syldap_add_single_value( ld,
e, attribute );
                        }
+                       /* Free memory used to store attribute */
+                       ldap_memfree( attribute );
                }

-               /* Free memory used to store attribute */
-               ldap_memfree( attribute );
-
                /* Format and add items to cache */
                syldap_build_items_fl( ldapServer, listAddress,
listFirst, listLast );


More information about the Sylpheed mailing list