]> git.ipfire.org Git - thirdparty/git.git/blobdiff - ref-filter.c
strmap: enable allocations to come from a mem_pool
[thirdparty/git.git] / ref-filter.c
index 5550a0d34c0940372a7ebe647b4a977f8a66793a..5e66b8cd765e0397b7ac41369ec121940671ae1b 100644 (file)
@@ -1557,9 +1557,7 @@ char *get_head_description(void)
                strbuf_addstr(&desc, _("no branch"));
        strbuf_addch(&desc, ')');
 
-       free(state.branch);
-       free(state.onto);
-       free(state.detached_from);
+       wt_status_state_free_buffers(&state);
        return strbuf_detach(&desc, NULL);
 }
 
@@ -2224,7 +2222,7 @@ void ref_array_clear(struct ref_array *array)
        used_atom_cnt = 0;
 
        if (ref_to_worktree_map.worktrees) {
-               hashmap_free_entries(&(ref_to_worktree_map.map),
+               hashmap_clear_and_free(&(ref_to_worktree_map.map),
                                        struct ref_to_worktree_entry, ent);
                free_worktrees(ref_to_worktree_map.worktrees);
                ref_to_worktree_map.worktrees = NULL;
@@ -2239,12 +2237,14 @@ static void reach_filter(struct ref_array *array,
 {
        struct rev_info revs;
        int i, old_nr;
-       struct commit **to_clear = xcalloc(sizeof(struct commit *), array->nr);
+       struct commit **to_clear;
        struct commit_list *cr;
 
        if (!check_reachable)
                return;
 
+       to_clear = xcalloc(sizeof(struct commit *), array->nr);
+
        repo_init_revisions(the_repository, &revs, NULL);
 
        for (i = 0; i < array->nr; i++) {