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