Merge branch 'bw/push-options-recursively-to-submodules' into next
[gitweb.git] / prio-queue.c
index 17252d231b31f2b8d82d7160d7b95709e14779ff..126d09672738533b6ecc6b94b7405dff888bbaf6 100644 (file)
@@ -21,16 +21,15 @@ void prio_queue_reverse(struct prio_queue *queue)
 
        if (queue->compare != NULL)
                die("BUG: prio_queue_reverse() on non-LIFO queue");
-       for (i = 0; i <= (j = (queue->nr - 1) - i); i++)
+       for (i = 0; i < (j = (queue->nr - 1) - i); i++)
                swap(queue, i, j);
 }
 
 void clear_prio_queue(struct prio_queue *queue)
 {
-       free(queue->array);
+       FREE_AND_NULL(queue->array);
        queue->nr = 0;
        queue->alloc = 0;
-       queue->array = NULL;
        queue->insertion_ctr = 0;
 }