@@ -251,24 +251,6 @@ static void php_oci_init_global_handles(void)
251
251
}
252
252
/* }}} */
253
253
254
- /* {{{ php_oci_cleanup_global_handles()
255
- *
256
- * Free global handles (if they were initialized before)
257
- */
258
- static void php_oci_cleanup_global_handles (void )
259
- {
260
- if (OCI_G (err )) {
261
- PHP_OCI_CALL (OCIHandleFree , ((dvoid * ) OCI_G (err ), OCI_HTYPE_ERROR ));
262
- OCI_G (err ) = NULL ;
263
- }
264
-
265
- if (OCI_G (env )) {
266
- PHP_OCI_CALL (OCIHandleFree , ((dvoid * ) OCI_G (env ), OCI_HTYPE_ENV ));
267
- OCI_G (env ) = NULL ;
268
- }
269
- }
270
- /* }}} */
271
-
272
254
/* {{{ PHP_GINIT_FUNCTION
273
255
*
274
256
* Zerofill globals during module init
@@ -282,10 +264,23 @@ static PHP_GINIT_FUNCTION(oci)
282
264
/* {{{ PHP_GSHUTDOWN_FUNCTION
283
265
*
284
266
* Called for thread shutdown in ZTS, after module shutdown for non-ZTS
267
+ * Free global handles (if they were initialized before)
285
268
*/
286
269
static PHP_GSHUTDOWN_FUNCTION (oci )
287
270
{
288
- php_oci_cleanup_global_handles ();
271
+ if (oci_globals -> err ) {
272
+ oci_globals -> in_call = 1 ;
273
+ OCIHandleFree ((dvoid * ) oci_globals -> err , OCI_HTYPE_ERROR );
274
+ oci_globals -> in_call = 0 ;
275
+ oci_globals -> err = NULL ;
276
+ }
277
+
278
+ if (oci_globals -> env ) {
279
+ oci_globals -> in_call = 1 ;
280
+ OCIHandleFree ((dvoid * ) oci_globals -> env , OCI_HTYPE_ENV );
281
+ oci_globals -> in_call = 0 ;
282
+ oci_globals -> env = NULL ;
283
+ }
289
284
}
290
285
/* }}} */
291
286
0 commit comments