static inline php_persistent_handle_list_t *php_persistent_handle_list_init(
php_persistent_handle_list_t *list)
{
- list = pemalloc(sizeof(*list), 1);
+ if (!list) {
+ list = pemalloc(sizeof(*list), 1);
+ }
list->used = 0;
zend_hash_init(&list->free, 0, NULL, NULL, 1);
{
php_persistent_handle_list_t *list = Z_PTR_P(p);
php_persistent_handle_list_free(&list, provider TSRMLS_CC);
+ ZVAL_PTR(p, NULL);
return ZEND_HASH_APPLY_REMOVE;
}
zval p;
ZVAL_PTR(&p, list);
- if (zend_symtable_str_update(&provider->list.free, ident_str, ident_len+1,
+ if (zend_symtable_str_update(&provider->list.free, ident_str, ident_len,
&p)) {
#if PHP_RAPHF_DEBUG_PHANDLES
fprintf(stderr, "LSTFIND: %p (new)\n", list);
ZVAL_PTR(&p, provider);
if (zend_symtable_str_update(&PHP_RAPHF_G->persistent_handle.hash,
- name_str, name_len+1, &p)) {
+ name_str, name_len, &p)) {
return SUCCESS;
}
php_resource_factory_dtor(&provider->rf);
init_arg TSRMLS_CC);
}
#if PHP_RAPHF_DEBUG_PHANDLES
- fprintf(stderr, "CREATED: %p\n", *handle);
+ fprintf(stderr, "CREATED: %p\n", handle);
#endif
if (handle) {
++a->provider->list.used;
if (list) {
if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
#if PHP_RAPHF_DEBUG_PHANDLES
- fprintf(stderr, "DESTROY: %p\n", *handle);
+ fprintf(stderr, "DESTROY: %p\n", handle);
#endif
php_resource_factory_handle_dtor(&a->provider->rf, handle TSRMLS_CC);
} else {