fix leaks
authorMichael Wallner <mike@php.net>
Wed, 31 Oct 2018 11:31:38 +0000 (12:31 +0100)
committerMichael Wallner <mike@php.net>
Wed, 31 Oct 2018 11:31:38 +0000 (12:31 +0100)
src/call.c
src/types/let_func.c

index 2c18e9b..c5aa4b7 100644 (file)
@@ -199,13 +199,15 @@ zval *psi_call_frame_sub_argument(struct psi_call_frame *frame,
        if (!iarg) {
                struct psi_call_frame_argument *frame_arg;
                impl_val empty_val = {0};
+               zend_string *type_str = zend_string_init(ZEND_STRL("mixed"), 1);
                struct psi_impl_arg *carg_spec = psi_impl_arg_init(
-                               psi_impl_type_init(PSI_T_MIXED, zend_string_init(ZEND_STRL("mixed"), 1)),
+                               psi_impl_type_init(PSI_T_MIXED, type_str),
                                psi_impl_var_copy(inner_var), NULL);
 
                psi_call_frame_push_auto_ex(frame, carg_spec, (void(*)(void*)) psi_impl_arg_free);
                frame_arg = psi_call_frame_argument_init(carg_spec, &empty_val, inner_zval, 0);
                zend_hash_add_ptr(&frame->arguments, name, frame_arg);
+               zend_string_release(type_str);
        }
 
        return inner_zval;
index ae8832f..ea2f371 100644 (file)
@@ -350,11 +350,12 @@ static void *exec_let_func_arrval(struct psi_let_exp *val,
 
                if (frame_arg->zval_ptr) {
                        while (psi_plist_get(func->inner, i++, &inner)) {
-                               darg_member = psi_decl_arg_get_by_name(darg_members,
-                                               psi_let_exp_get_decl_var_name(inner));
+                               zend_string *var_name = psi_let_exp_get_decl_var_name(inner);
+                               darg_member = psi_decl_arg_get_by_name(darg_members, var_name);
 
                                exec_let_func_arrval_inner(func, darg, darg_member, frame_arg,
                                                inner, container, frame);
+                               zend_string_release(var_name);
                        }
                }
        } else if (func->inner) {