]> mj.ucw.cz Git - libucw.git/blobdiff - lib/workqueue.c
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / 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;