tony2001 Wed Apr 16 13:20:59 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/ldap ldap.c Log: plug minor memleak http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.161.2.3.2.11.2.5&r2=1.161.2.3.2.11.2.6&diff_format=u Index: php-src/ext/ldap/ldap.c diff -u php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.5 php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.6 --- php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.5 Sat Feb 9 21:59:17 2008 +++ php-src/ext/ldap/ldap.c Wed Apr 16 13:20:59 2008 @@ -23,7 +23,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c,v 1.161.2.3.2.11.2.5 2008/02/09 21:59:17 johannes Exp $ */ +/* $Id: ldap.c,v 1.161.2.3.2.11.2.6 2008/04/16 13:20:59 tony2001 Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -327,7 +327,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161.2.3.2.11.2.5 2008/02/09 21:59:17 johannes Exp $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.161.2.3.2.11.2.6 2008/04/16 13:20:59 tony2001 Exp $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -1425,6 +1425,7 @@ for (i = 0; i < num_attribs; i++) { ldap_mods[i] = emalloc(sizeof(LDAPMod)); ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; + ldap_mods[i]->mod_type = NULL; if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) { ldap_mods[i]->mod_type = estrdup(attribute); @@ -1432,7 +1433,11 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown attribute in the data"); /* Free allocated memory */ while (i >= 0) { - efree(ldap_mods[i--]); + if (ldap_mods[i]->mod_type) { + efree(ldap_mods[i]->mod_type); + } + efree(ldap_mods[i]); + i--; } efree(num_berval); efree(ldap_mods);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php