]> mj.ucw.cz Git - libucw.git/commitdiff
fixed off-by-one error in workqueue
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 23 Apr 2007 18:00:55 +0000 (20:00 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Mon, 23 Apr 2007 18:00:55 +0000 (20:00 +0200)
lib/workqueue.c

index 325cedf7f71950bd2c47825c25aa5d9c3f6e2987..8833e46f9d7a5ebcc29f5c4cc32e8e64d8a44b09 100644 (file)
@@ -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;