Skip to content

Commit 4c26bec

Browse files
committed
Fix memory leak in handle_mapping()
We must not forget to release the previously created array in case we return early due to an undefined value. This memory leak could be observed when running `yaml_parse_003.phpt` and `yaml_parse_004.phpt` under a debug build or with a leak checker.
1 parent 0c81894 commit 4c26bec

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

parse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ void handle_mapping(parser_state_t *state, zval *retval)
403403
if (Z_TYPE(value) == IS_UNDEF) {
404404
yaml_event_delete(&src_event);
405405
yaml_event_delete(&key_event);
406+
zval_ptr_dtor(&key);
406407
return;
407408
}
408409

0 commit comments

Comments
 (0)