]> granicus.if.org Git - php/commitdiff
change handles destruction order (based on the patch by Chris Jones) and fix typo
authorAntony Dovgal <tony2001@php.net>
Fri, 25 Nov 2005 10:16:55 +0000 (10:16 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 25 Nov 2005 10:16:55 +0000 (10:16 +0000)
ext/oci8/oci8.c

index a3c9d03b5dd5b3f4fb59ea5507b250d55c2ed233..59cd96d2b7eb900762f3c298f0acda3cc4eff304 100644 (file)
@@ -441,7 +441,7 @@ oci_error:
 static void php_oci_cleanup_global_handles(TSRMLS_D)
 {
        if (OCI_G(err)) {
-               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ENV));
+               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) OCI_G(err), OCI_HTYPE_ERROR));
                OCI_G(err) = NULL;
        }
        
@@ -1408,30 +1408,30 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
                }
        }
 
+       if (connection->svc && connection->session && connection->is_open) {
+               PHP_OCI_CALL(OCISessionEnd, (connection->svc, OCI_G(err), connection->session, (ub4) 0));
+       }
+       
+       if (connection->session) {
+               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION));
+       }
+       
        if (connection->is_attached) {
                PHP_OCI_CALL(OCIServerDetach, (connection->server, OCI_G(err), OCI_DEFAULT));
        }
        
+       if (connection->svc) {
+               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX));
+       }
+       
        if (connection->err) {
                PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->err, (ub4) OCI_HTYPE_ERROR));
        }
-
-       if (connection->session) {
-               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->session, OCI_HTYPE_SESSION));
-       }
        
        if (connection->server) {
                PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->server, (ub4) OCI_HTYPE_SERVER));
        }
        
-       if (connection->svc) {
-               if (connection->session && connection->is_open) {
-                       PHP_OCI_CALL(OCISessionEnd, (connection->svc, OCI_G(err), connection->session, (ub4) 0));
-               }
-       
-               PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX));
-       }
-               
        if (connection->env) {
                PHP_OCI_CALL(OCIHandleFree, ((dvoid *) connection->env, OCI_HTYPE_ENV));
        }