From 12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 15 Oct 2022 09:08:09 -0400 Subject: move buflib_free invalid handle check to the function allow buflib_free to check for invalid or already freed handles within the function -- remove all the invalid handle guards thru core_free Change-Id: Ibdcbc82760fc93b674c42283fca420d94907df8e --- lib/x1000-installer/src/xf_nandio.c | 5 +---- lib/x1000-installer/src/xf_package.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'lib/x1000-installer/src') diff --git a/lib/x1000-installer/src/xf_nandio.c b/lib/x1000-installer/src/xf_nandio.c index 29ff9d9120..6dc87bc420 100644 --- a/lib/x1000-installer/src/xf_nandio.c +++ b/lib/x1000-installer/src/xf_nandio.c @@ -75,10 +75,7 @@ int xf_nandio_init(struct xf_nandio* nio) void xf_nandio_destroy(struct xf_nandio* nio) { - if(nio->alloc_handle > 0) { - core_free(nio->alloc_handle); - nio->alloc_handle = 0; - } + nio->alloc_handle = core_free(nio->alloc_handle); if(nio->ndrv) { nand_lock(nio->ndrv); diff --git a/lib/x1000-installer/src/xf_package.c b/lib/x1000-installer/src/xf_package.c index 04b32cdcb0..fb107aef72 100644 --- a/lib/x1000-installer/src/xf_package.c +++ b/lib/x1000-installer/src/xf_package.c @@ -257,8 +257,5 @@ void xf_package_close(struct xf_package* pkg) if(mtar_is_open(pkg->tar)) mtar_close(pkg->tar); - if(pkg->alloc_handle > 0) { - core_free(pkg->alloc_handle); - pkg->alloc_handle = 0; - } + pkg->alloc_handle = core_free(pkg->alloc_handle); } -- cgit v1.2.3