From 68f1098ef3c867ea1124e4847788c990a6dba227 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 22 Dec 2024 21:34:32 +0100 Subject: [PATCH] Fix memory leak on ZEND_FFI_TYPE_CHAR conversion failure The success path frees tmp_str, but the error path does not. --- ext/ffi/ffi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 2000e15c29ea1..d823f32127cfb 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -807,6 +807,7 @@ static zend_always_inline zend_result zend_ffi_zval_to_cdata(void *ptr, zend_ffi if (ZSTR_LEN(str) == 1) { *(char*)ptr = ZSTR_VAL(str)[0]; } else { + zend_tmp_string_release(tmp_str); zend_ffi_assign_incompatible(value, type); return FAILURE; }