From: Pavel Charvat Date: Mon, 23 Apr 2007 18:00:55 +0000 (+0200) Subject: fixed off-by-one error in workqueue X-Git-Tag: holmes-import~506^2~82 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=44d2b249877fd00ada7f39ec013f84d36715aab5;p=libucw.git fixed off-by-one error in workqueue --- 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;