[asterisk-commits] seanbright: branch 1.6.2 r304865 - /branches/1.6.2/res/res_config_ldap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 29 17:05:30 CST 2011


Author: seanbright
Date: Sat Jan 29 17:05:25 2011
New Revision: 304865

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=304865
Log:
Plug some memory leaks in the LDAP realtime driver.

(closes issue #18435)
Reported by: zaltar
Patches:
      res_config_ldap.patch uploaded by zaltar (license 1148)

Modified:
    branches/1.6.2/res/res_config_ldap.c

Modified: branches/1.6.2/res/res_config_ldap.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/res/res_config_ldap.c?view=diff&rev=304865&r1=304864&r2=304865
==============================================================================
--- branches/1.6.2/res/res_config_ldap.c (original)
+++ branches/1.6.2/res/res_config_ldap.c Sat Jan 29 17:05:25 2011
@@ -330,6 +330,7 @@
 			}
 			ldap_value_free_len(values);
 		}
+		ldap_memfree(ldap_attribute_name);
 		ldap_attribute_name = ldap_next_attribute(ldapConn, ldap_entry, ber);
 	}
 	ber_free(ber, 0);
@@ -496,6 +497,7 @@
 					} /*!< for (v = values; *v; v++) */
 					ldap_value_free_len(values);
 				}/*!< if (values) */
+				ldap_memfree(ldap_attribute_name);
 				ldap_attribute_name = ldap_next_attribute(ldapConn, ldap_entry, ber);
 			} /*!< while (ldap_attribute_name) */
 			ber_free(ber, 0);
@@ -1311,7 +1313,7 @@
 			dn = ldap_get_dn(ldapConn, ldap_entry);
 			if ((error = ldap_modify_ext_s(ldapConn, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) 
 				ast_log(LOG_ERROR, "Couldn't modify dn:%s because %s", dn, ldap_err2string(error));
-
+			ldap_memfree(dn);
 			ldap_entry = ldap_next_entry(ldapConn, ldap_entry);
 		}
 	}
@@ -1493,7 +1495,7 @@
 			dn = ldap_get_dn(ldapConn, ldap_entry);
 			if ((error = ldap_modify_ext_s(ldapConn, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) 
 				ast_log(LOG_ERROR, "Couldn't modify dn:%s because %s", dn, ldap_err2string(error));
-
+			ldap_memfree(dn);
 			ldap_entry = ldap_next_entry(ldapConn, ldap_entry);
 		}
 	}




More information about the asterisk-commits mailing list