cvs: php4 /ext/ldap ldap.c

From: Date: Wed, 14 Nov 2001 22:05:33 +0000
Subject: cvs: php4 /ext/ldap ldap.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8212@lists.php.net to get a copy of this message
venaas Wed Nov 14 17:05:33 2001 EDT Modified files: /php4/ext/ldap ldap.c Log: Fixed some memory leaks and removed some unnecessary checks due to ZEND_FETCH_RESOURCE returning on error Index: php4/ext/ldap/ldap.c diff -u php4/ext/ldap/ldap.c:1.103 php4/ext/ldap/ldap.c:1.104 --- php4/ext/ldap/ldap.c:1.103 Tue Nov 13 13:05:47 2001 +++ php4/ext/ldap/ldap.c Wed Nov 14 17:05:33 2001 @@ -22,7 +22,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c,v 1.103 2001/11/13 18:05:47 venaas Exp $ */ +/* $Id: ldap.c,v 1.104 2001/11/14 22:05:33 venaas Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -256,7 +256,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.103 2001/11/13 18:05:47 venaas Exp $" ); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.104 2001/11/14 22:05:33 venaas Exp $" ); php_info_print_table_row(2, "Total Links", maxl ); #ifdef LDAP_API_VERSION @@ -654,8 +654,7 @@ for (i=0; i<nlinks; i++) { zend_hash_get_current_data(Z_ARRVAL_PP(link), (void **)&entry); - ZEND_FETCH_RESOURCE(ldap, LDAP *, entry, -1, "ldap link", le_link); - + ldap = (LDAP *) zend_fetch_resource(entry TSRMLS_CC, -1, "ldap link", NULL, 1, le_link); if (ldap == NULL) { efree(links); efree(rcs); @@ -716,7 +715,7 @@ ldap_base_dn = NULL; } - ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); + ldap = (LDAP *) zend_fetch_resource(link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link); if (ldap == NULL) { if (ldap_attrs != NULL) { efree(ldap_attrs); @@ -796,13 +795,8 @@ ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result); - if (ldap_result == NULL) { - RETVAL_FALSE; - } else { - zend_list_delete(Z_LVAL_PP(result)); /* Delete list entry and call registered destructor function */ - RETVAL_TRUE; - } - return; + zend_list_delete(Z_LVAL_PP(result)); /* Delete list entry and call registered destructor function */ + RETVAL_TRUE; } /* }}} */ @@ -1458,10 +1452,6 @@ ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); - if (ldap == NULL) { - RETURN_LONG(0); - } - RETURN_LONG( _get_lderrno(ldap) ); } /* }}} */ @@ -1515,8 +1505,6 @@ } ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); - - if (ldap == NULL) RETURN_LONG(-1); convert_to_string_ex(dn); convert_to_string_ex(attr);

« previous php.cvs (#8212) next »