summaryrefslogtreecommitdiff
path: root/firmware/common/dircache.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-10-15 09:08:09 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2022-10-15 09:26:58 -0400
commit12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69 (patch)
treeb4885951a5cba1b78c21b30ce37a1d6f1574aa5f /firmware/common/dircache.c
parent9d3d925295112a0080bc1d70fad170db9e1af2a9 (diff)
downloadrockbox-12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69.tar.gz
rockbox-12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69.zip
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
Diffstat (limited to 'firmware/common/dircache.c')
-rw-r--r--firmware/common/dircache.c8
1 files changed, 3 insertions, 5 deletions
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)
1963 int handle = reset_buffer(); 1963 int handle = reset_buffer();
1964 dircache_unlock(); 1964 dircache_unlock();
1965 1965
1966 if (handle > 0) 1966 core_free(handle);
1967 core_free(handle);
1968 1967
1969 handle = alloc_cache(size); 1968 handle = alloc_cache(size);
1970 1969
@@ -2164,8 +2163,7 @@ static void dircache_suspend_internal(bool freeit)
2164 2163
2165 dircache_unlock(); 2164 dircache_unlock();
2166 2165
2167 if (handle > 0) 2166 core_free(handle);
2168 core_free(handle);
2169 2167
2170 thread_wait(thread_id); 2168 thread_wait(thread_id);
2171 2169
@@ -3179,7 +3177,7 @@ error:
3179 dircache_unlock(); 3177 dircache_unlock();
3180 3178
3181error_nolock: 3179error_nolock:
3182 if (rc < 0 && handle > 0) 3180 if (rc < 0)
3183 core_free(handle); 3181 core_free(handle);
3184 3182
3185 if (fd >= 0) 3183 if (fd >= 0)