From 44d2b249877fd00ada7f39ec013f84d36715aab5 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Mon, 23 Apr 2007 20:00:55 +0200 Subject: [PATCH] fixed off-by-one error in workqueue --- lib/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/workqueue.c b/lib/workqueue.c index 325cedf7..8833e46f 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -128,7 +128,7 @@ raw_queue_put(struct raw_queue *q, struct work *w) { struct work **old_heap = q->pri_heap; q->heap_max = (q->heap_max ? 2*q->heap_max : 16); - q->pri_heap = xrealloc(old_heap, q->heap_max * sizeof(struct work *)); + q->pri_heap = xrealloc(old_heap, (q->heap_max + 1) * sizeof(struct work *)); } struct work **heap = q->pri_heap; heap[++q->heap_cnt] = w; -- 2.39.5