From cfebf2a690e1a0ad2255f64eec5bec43eeac0049 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 18 Jul 2026 21:54:50 +0800 Subject: fix mem leaks --- core/src/xmake/binutils/bin2c.c | 4 ++-- core/src/xmake/binutils/coff/bin2coff.c | 4 ++-- core/src/xmake/binutils/elf/bin2elf.c | 6 +++--- core/src/xmake/binutils/macho/bin2macho.c | 4 ++-- core/src/xmake/binutils/readsyms.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/src/xmake/binutils/bin2c.c b/core/src/xmake/binutils/bin2c.c index b5054c55f..3c639d059 100644 --- a/core/src/xmake/binutils/bin2c.c +++ b/core/src/xmake/binutils/bin2c.c @@ -209,12 +209,12 @@ tb_int_t xm_binutils_bin2c(lua_State *lua) { } while (0); if (istream) { - tb_stream_clos(istream); + tb_stream_exit(istream); } istream = tb_null; if (ostream) { - tb_stream_clos(ostream); + tb_stream_exit(ostream); } ostream = tb_null; diff --git a/core/src/xmake/binutils/coff/bin2coff.c b/core/src/xmake/binutils/coff/bin2coff.c index ceb984a5c..791d4e2ba 100644 --- a/core/src/xmake/binutils/coff/bin2coff.c +++ b/core/src/xmake/binutils/coff/bin2coff.c @@ -303,12 +303,12 @@ tb_int_t xm_binutils_bin2coff(lua_State *lua) { } while (0); if (istream) { - tb_stream_clos(istream); + tb_stream_exit(istream); } istream = tb_null; if (ostream) { - tb_stream_clos(ostream); + tb_stream_exit(ostream); } ostream = tb_null; diff --git a/core/src/xmake/binutils/elf/bin2elf.c b/core/src/xmake/binutils/elf/bin2elf.c index ad580ba84..585ddc681 100644 --- a/core/src/xmake/binutils/elf/bin2elf.c +++ b/core/src/xmake/binutils/elf/bin2elf.c @@ -94,7 +94,7 @@ static tb_bool_t xm_binutils_bin2elf_read_refobj(tb_char_t const *refobj, ok = tb_true; } while (0); - if (stream) tb_stream_clos(stream); + if (stream) tb_stream_exit(stream); return ok; } @@ -791,11 +791,11 @@ tb_int_t xm_binutils_bin2elf(lua_State *lua) { } while (0); if (istream) - tb_stream_clos(istream); + tb_stream_exit(istream); istream = tb_null; if (ostream) - tb_stream_clos(ostream); + tb_stream_exit(ostream); ostream = tb_null; return ok ? 1 : 2; diff --git a/core/src/xmake/binutils/macho/bin2macho.c b/core/src/xmake/binutils/macho/bin2macho.c index 0b9dad0c2..c3c1c7a5c 100644 --- a/core/src/xmake/binutils/macho/bin2macho.c +++ b/core/src/xmake/binutils/macho/bin2macho.c @@ -606,12 +606,12 @@ tb_int_t xm_binutils_bin2macho(lua_State *lua) { } while (0); if (istream) { - tb_stream_clos(istream); + tb_stream_exit(istream); } istream = tb_null; if (ostream) { - tb_stream_clos(ostream); + tb_stream_exit(ostream); } ostream = tb_null; diff --git a/core/src/xmake/binutils/readsyms.c b/core/src/xmake/binutils/readsyms.c index 2c119a538..cac501a69 100644 --- a/core/src/xmake/binutils/readsyms.c +++ b/core/src/xmake/binutils/readsyms.c @@ -82,7 +82,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) { lua_pushfstring(lua, "cannot detect file format"); break; } - + // create result list lua_newtable(lua); @@ -160,7 +160,7 @@ tb_int_t xm_binutils_readsyms(lua_State *lua) { } while (0); if (istream) { - tb_stream_clos(istream); + tb_stream_exit(istream); } istream = tb_null; -- cgit v1.3.1