Skip to content

Commit

Permalink
Refactor interception hash table update error handling
Browse files Browse the repository at this point in the history
Consolidate intercept info cleanup into a single function call to enhance code maintainability and readability. Replace manual resource release with `php_rayaop_free_intercept_info` ensuring consistent cleanup logic.
  • Loading branch information
koriym committed Nov 5, 2024
1 parent 5d59780 commit 3fcbbbe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rayaop.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,10 @@ PHP_FUNCTION(method_intercept) {
RAYAOP_G_LOCK();
if (zend_hash_str_update_ptr(RAYAOP_G(intercept_ht), key, key_len, info) == NULL) {
RAYAOP_G_UNLOCK();
zend_string_release(info->class_name);
zend_string_release(info->method_name);
zval_ptr_dtor(&info->handler);
efree(info);
efree(key);
zval tmp_zv;
ZVAL_PTR(&tmp_zv, info);
php_rayaop_free_intercept_info(&tmp_zv);
php_rayaop_handle_error(RAYAOP_E_HASH_UPDATE, "Failed to update intercept hash table");
RETURN_FALSE;
}
Expand Down

0 comments on commit 3fcbbbe

Please sign in to comment.