reftable: introduce REFTABLE_FREE_AND_NULL()

We have several calls to `FREE_AND_NULL()` in the reftable library,
which of course uses free(3P). As the reftable allocators are pluggable
we should rather call the reftable specific function, which is
`reftable_free()`.

Introduce a new macro `REFTABLE_FREE_AND_NULL()` and adapt the callsites
accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-10-02 12:56:36 +02:00
committed by Junio C Hamano
parent daa59e9c43
commit 24e0ade65b
9 changed files with 19 additions and 18 deletions

View File

@@ -203,7 +203,7 @@ void reftable_stack_destroy(struct reftable_stack *st)
err = read_lines(st->list_file, &names);
if (err < 0) {
FREE_AND_NULL(names);
REFTABLE_FREE_AND_NULL(names);
}
if (st->readers) {
@@ -224,7 +224,7 @@ void reftable_stack_destroy(struct reftable_stack *st)
}
strbuf_release(&filename);
st->readers_len = 0;
FREE_AND_NULL(st->readers);
REFTABLE_FREE_AND_NULL(st->readers);
}
if (st->list_fd >= 0) {
@@ -232,8 +232,8 @@ void reftable_stack_destroy(struct reftable_stack *st)
st->list_fd = -1;
}
FREE_AND_NULL(st->list_file);
FREE_AND_NULL(st->reftable_dir);
REFTABLE_FREE_AND_NULL(st->list_file);
REFTABLE_FREE_AND_NULL(st->reftable_dir);
reftable_free(st);
free_names(names);
}