@@ -865,6 +865,9 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
865865 if (!connection -> info -> lock .fp ) {
866866 /* stream operation already wrote an error message */
867867 efree (resource_key );
868+ zend_string_release_ex (connection -> hash , persistent );
869+ dba_close_info (connection -> info );
870+ connection -> info = NULL ;
868871 zval_ptr_dtor (return_value );
869872 RETURN_FALSE ;
870873 }
@@ -886,6 +889,9 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
886889 if (!connection -> info -> fp ) {
887890 /* stream operation already wrote an error message */
888891 efree (resource_key );
892+ zend_string_release_ex (connection -> hash , persistent );
893+ dba_close_info (connection -> info );
894+ connection -> info = NULL ;
889895 zval_ptr_dtor (return_value );
890896 RETURN_FALSE ;
891897 }
@@ -896,6 +902,9 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
896902 if (SUCCESS != php_stream_cast (connection -> info -> fp , PHP_STREAM_AS_FD , (void * )& connection -> info -> fd , 1 )) {
897903 php_error_docref (NULL , E_WARNING , "Could not cast stream" );
898904 efree (resource_key );
905+ zend_string_release_ex (connection -> hash , persistent );
906+ dba_close_info (connection -> info );
907+ connection -> info = NULL ;
899908 zval_ptr_dtor (return_value );
900909 RETURN_FALSE ;
901910#ifdef F_SETFL
@@ -932,6 +941,9 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
932941 }
933942 }
934943 efree (resource_key );
944+ zend_string_release_ex (connection -> hash , persistent );
945+ dba_close_info (connection -> info );
946+ connection -> info = NULL ;
935947 zval_ptr_dtor (return_value );
936948 RETURN_FALSE ;
937949 }
@@ -942,6 +954,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
942954 if (zend_register_persistent_resource (resource_key , resource_key_len , connection -> info , le_pdb ) == NULL ) {
943955 php_error_docref (NULL , E_WARNING , "Could not register persistent resource" );
944956 efree (resource_key );
957+ dba_close_connection (connection );
945958 zval_ptr_dtor (return_value );
946959 RETURN_FALSE ;
947960 }
0 commit comments