X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fworkqueue.c;h=8833e46f9d7a5ebcc29f5c4cc32e8e64d8a44b09;hb=e42cd882d7970eb0b01bc9b058e0446996212cb4;hp=325cedf7f71950bd2c47825c25aa5d9c3f6e2987;hpb=fe41a1f4c5b1313cbbf900a00c194aafcce7575b;p=libucw.git 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;