]> granicus.if.org Git - php/commitdiff
Fixed a memory leak on ldap_connect() failure.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 30 Oct 2002 18:12:34 +0000 (18:12 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 30 Oct 2002 18:12:34 +0000 (18:12 +0000)
ext/ldap/ldap.c

index 7c38088a458b65cf5d9652993c7e2b73943047f3..edff9b6ce0865fb52e89b2bc4be861b63252c29b 100644 (file)
@@ -387,6 +387,7 @@ PHP_FUNCTION(ldap_connect)
                
                rc = ldap_initialize(&ldap, host);
                if (rc != LDAP_SUCCESS) {
+                       efree(ld);
                        php_error(E_WARNING, "%s(): Could not create session handle: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc));
                        RETURN_FALSE;
                }
@@ -398,11 +399,13 @@ PHP_FUNCTION(ldap_connect)
 #endif
        
        if ( ldap == NULL ) {
+               efree(ld);
                RETURN_FALSE;
        } else {
 #ifdef HAVE_ORALDAP
                if (ssl) {
                        if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) {
+                               efree(ld);
                                php_error(E_WARNING, "%s(): SSL init failed", get_active_function_name(TSRMLS_C));
                                RETURN_FALSE;
                        }