return 0;
}
+/* Free memory allocated for a ref_array_item */
+static void free_array_item(struct ref_array_item *item)
+{
+ free((char *)item->symref);
+ free(item->refname);
+ free(item);
+}
+
+/* Free all memory allocated for ref_array */
+void ref_array_clear(struct ref_array *array)
+{
+ int i;
+
+ for (i = 0; i < array->nr; i++)
+ free_array_item(array->items[i]);
+ free(array->items);
+ array->items = NULL;
+ array->nr = array->alloc = 0;
+}
+
static int cmp_ref_sort(struct ref_sort *s, struct ref_array_item *a, struct ref_array_item *b)
{
struct atom_value *va, *vb;
maxcount = ref_cbdata.array.nr;
for (i = 0; i < maxcount; i++)
show_ref(ref_cbdata.array.items[i], format, quote_style);
+ ref_array_clear(&ref_cbdata.array);
return 0;
}