X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/6465356a983ac139f81d3b7913cdb548477c346c..refs/heads/master:/gen/FreeBSD/err.c diff --git a/gen/FreeBSD/err.c b/gen/FreeBSD/err.c index 39fac8a..f763764 100644 --- a/gen/FreeBSD/err.c +++ b/gen/FreeBSD/err.c @@ -159,7 +159,13 @@ err_set_file(void *fp) void err_set_exit(void (*ef)(int)) { - _e_err_exit.type = ERR_EXIT_FUNC; +#ifdef __BLOCKS__ + if (_e_err_exit.type == ERR_EXIT_BLOCK) { + Block_release(_e_err_exit.block); + _e_err_exit.block = NULL; + } +#endif /* __BLOCKS__ */ + _e_err_exit.type = ef ? ERR_EXIT_FUNC : ERR_EXIT_UNDEF; _e_err_exit.func = ef; } @@ -167,7 +173,10 @@ err_set_exit(void (*ef)(int)) void err_set_exit_b(void (^ef)(int)) { - _e_err_exit.type = ERR_EXIT_BLOCK; + if (_e_err_exit.type == ERR_EXIT_BLOCK) { + Block_release(_e_err_exit.block); + } + _e_err_exit.type = ef ? ERR_EXIT_BLOCK : ERR_EXIT_UNDEF; _e_err_exit.block = Block_copy(ef); } #endif /* __BLOCKS__ */