summaryrefslogtreecommitdiffstats
path: root/firmware/buflib.c
diff options
context:
space:
mode:
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,
int
buflib_free(struct buflib_context *ctx, int handle_num)
{
+ if (handle_num <= 0) /* invalid or already free */
+ return handle_num;
union buflib_data *handle = ctx->handle_table - handle_num,
*freed_block = handle_to_block(ctx, handle_num),
*block, *next_block;