diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2019-06-17 14:40:19 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2019-06-17 14:40:19 +0300 |
| commit | 1e0b0467b649b4854865e4bf70bcb3c805927611 (patch) | |
| tree | 5a715844ed26715c5fe6319a943b5e35e1783ee1 /ext/ffi/ffi.c | |
| parent | ad1b62fca70f911329bbff186a1319738d4a299a (diff) | |
| download | php-git-1e0b0467b649b4854865e4bf70bcb3c805927611.tar.gz | |
Fixed memory leaks in ext/ffi/tests/100.phpt on Mac OSX
Diffstat (limited to 'ext/ffi/ffi.c')
| -rw-r--r-- | ext/ffi/ffi.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 08e96f43d7..6293964d80 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -5709,7 +5709,7 @@ static int zend_ffi_validate_func_ret_type(zend_ffi_type *type) /* {{{ */ } /* }}} */ -void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args) /* {{{ */ +void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args, zend_ffi_dcl *nested_dcl) /* {{{ */ { zend_ffi_type *type; zend_ffi_type *ret_type; @@ -5725,6 +5725,7 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args) /* {{{ */ arg_type = ZEND_FFI_TYPE(arg_type); if (arg_type->kind == ZEND_FFI_TYPE_VOID) { if (zend_hash_num_elements(args) != 1) { + zend_ffi_cleanup_dcl(nested_dcl); zend_ffi_cleanup_dcl(dcl); zend_hash_destroy(args); pefree(args, FFI_G(persistent)); @@ -5743,6 +5744,7 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args) /* {{{ */ } if (zend_ffi_validate_func_ret_type(ret_type) != SUCCESS) { + zend_ffi_cleanup_dcl(nested_dcl); zend_ffi_cleanup_dcl(dcl); if (args) { zend_hash_destroy(args); @@ -5799,6 +5801,12 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args) /* {{{ */ #endif default: type->func.abi = FFI_DEFAULT_ABI; + zend_ffi_cleanup_dcl(nested_dcl); + if (args) { + zend_hash_destroy(args); + pefree(args, FFI_G(persistent)); + } + _zend_ffi_type_dtor(type); zend_ffi_parser_error("unsupported calling convention line %d", FFI_G(line)); break; } |
