Please move this cleanup code to function ./bootloader/common/pyi_utils.c:pyi_utils_create_child()