summaryrefslogtreecommitdiff
path: root/firmware/buflib.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/buflib.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/buflib.c')
-rw-r--r--firmware/buflib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 7263f1b95d..3130bc960c 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -820,6 +820,8 @@ find_block_before(struct buflib_context *ctx, union buflib_data* block,
820int 820int
821buflib_free(struct buflib_context *ctx, int handle_num) 821buflib_free(struct buflib_context *ctx, int handle_num)
822{ 822{
823 if (handle_num <= 0) /* invalid or already free */
824 return handle_num;
823 union buflib_data *handle = ctx->handle_table - handle_num, 825 union buflib_data *handle = ctx->handle_table - handle_num,
824 *freed_block = handle_to_block(ctx, handle_num), 826 *freed_block = handle_to_block(ctx, handle_num),
825 *block, *next_block; 827 *block, *next_block;