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 --- firmware/common/dircache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'firmware/common/dircache.c') diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 7a84b761a0..8917b3348e 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -1963,8 +1963,7 @@ static int prepare_build(bool *realloced) int handle = reset_buffer(); dircache_unlock(); - if (handle > 0) - core_free(handle); + core_free(handle); handle = alloc_cache(size); @@ -2164,8 +2163,7 @@ static void dircache_suspend_internal(bool freeit) dircache_unlock(); - if (handle > 0) - core_free(handle); + core_free(handle); thread_wait(thread_id); @@ -3179,7 +3177,7 @@ error: dircache_unlock(); error_nolock: - if (rc < 0 && handle > 0) + if (rc < 0) core_free(handle); if (fd >= 0) -- cgit v1.2.3