In most user extensions functions like mysql_close() should use zend_list_close() instead of zend_list_delete(). This closes the actual connection and frees extension specific data structures, but doesn't free zend_reference structure that might be referenced from zval(s). This also doesn't decrement the resource reference counter.

This commit is contained in:
Dmitry Stogov 2014-05-13 13:18:00 +04:00
parent f1720348ca
commit b8b8c497c4
5 changed files with 6 additions and 6 deletions

View File

@ -3136,7 +3136,7 @@ PHP_FUNCTION(curl_close)
return;
}
zend_list_delete(Z_RES_P(zid));
zend_list_close(Z_RES_P(zid));
}
/* }}} */

View File

@ -4011,7 +4011,7 @@ PHP_FUNCTION(imagepsfreefont)
}
ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
zend_list_delete(Z_LVAL_P(fnt));
zend_list_close(Z_RES_P(fnt));
RETURN_TRUE;
}
/* }}} */

View File

@ -588,7 +588,7 @@ PHP_FUNCTION(mcrypt_generic_init)
/* If this function fails, close the mcrypt module to prevent crashes
* when further functions want to access this resource */
if (result < 0) {
zend_list_delete(Z_RES_P(mcryptind));
zend_list_close(Z_RES_P(mcryptind));
switch (result) {
case -3:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key length incorrect");
@ -733,7 +733,7 @@ PHP_FUNCTION(mcrypt_enc_self_test)
PHP_FUNCTION(mcrypt_module_close)
{
MCRYPT_GET_TD_ARG
zend_list_delete(Z_RES_P(mcryptind));
zend_list_close(Z_RES_P(mcryptind));
RETURN_TRUE;
}
/* }}} */

View File

@ -212,7 +212,7 @@ PHP_FUNCTION(shm_detach)
return;
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
RETURN_BOOL(SUCCESS == zend_list_delete(Z_RES_P(shm_id)));
RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(shm_id)));
}
/* }}} */

View File

@ -1187,7 +1187,7 @@ PHP_FUNCTION(wddx_packet_end)
RETVAL_STR(STR_COPY(packet->s));
zend_list_delete(Z_RES_P(packet_id));
zend_list_close(Z_RES_P(packet_id));
}
/* }}} */