Skip to content

Commit a7f7e16

Browse files
committed
Fix memory leak on ZEND_FFI_TYPE_CHAR conversion failure
The success path frees tmp_str, but the error path does not. Closes GH-17243.
1 parent fcbfd5a commit a7f7e16

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ PHP NEWS
2424

2525
- FFI:
2626
. Fixed bug #79075 (FFI header parser chokes on comments). (nielsdos)
27+
. Fix memory leak on ZEND_FFI_TYPE_CHAR conversion failure. (nielsdos)
2728

2829
- Filter:
2930
. Fixed bug GH-16944 (Fix filtering special IPv4 and IPv6 ranges, by using

ext/ffi/ffi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ static zend_always_inline zend_result zend_ffi_zval_to_cdata(void *ptr, zend_ffi
807807
if (ZSTR_LEN(str) == 1) {
808808
*(char*)ptr = ZSTR_VAL(str)[0];
809809
} else {
810+
zend_tmp_string_release(tmp_str);
810811
zend_ffi_assign_incompatible(value, type);
811812
return FAILURE;
812813
}

0 commit comments

Comments
 (0)