reftable: all xxx_free() functions accept NULL arguments
This fixes NULL derefs in error paths. Spotted by Coverity. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b20aab5017
commit
33e9224320
@ -646,6 +646,8 @@ int reftable_new_reader(struct reftable_reader **p,
|
||||
|
||||
void reftable_reader_free(struct reftable_reader *r)
|
||||
{
|
||||
if (!r)
|
||||
return;
|
||||
reader_close(r);
|
||||
reftable_free(r);
|
||||
}
|
||||
|
@ -150,6 +150,8 @@ void reftable_writer_set_limits(struct reftable_writer *w, uint64_t min,
|
||||
|
||||
void reftable_writer_free(struct reftable_writer *w)
|
||||
{
|
||||
if (!w)
|
||||
return;
|
||||
reftable_free(w->block);
|
||||
reftable_free(w);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user