summaryrefslogtreecommitdiff
path: root/firmware/buflib.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/buflib.c')
-rw-r--r--firmware/buflib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 05e489ea14..4b557eb59d 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -196,8 +196,17 @@ union buflib_data* handle_alloc(struct buflib_context *ctx)
196 if (handle >= ctx->alloc_end) 196 if (handle >= ctx->alloc_end)
197 ctx->last_handle--; 197 ctx->last_handle--;
198 else 198 else
199 {
200 /* We know the table is full, so update first_free_handle */
201 ctx->first_free_handle = ctx->last_handle - 1;
199 return NULL; 202 return NULL;
203 }
200 } 204 }
205
206 /* We know there are no free handles between the old first_free_handle
207 * and the found handle, therefore we can update first_free_handle */
208 ctx->first_free_handle = handle - 1;
209
201 handle->val = -1; 210 handle->val = -1;
202 return handle; 211 return handle;
203} 212}