X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fworkqueue.c;h=8833e46f9d7a5ebcc29f5c4cc32e8e64d8a44b09;hb=ba9c448bb5446d0100173e7a594bcb1d849b4e39;hp=325cedf7f71950bd2c47825c25aa5d9c3f6e2987;hpb=314027856c1d6ccb92bc625f4284cd36655fb154;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;