diff mbox series

[02/10] t-reftable-block: release used block reader

Message ID 20240814121122.4642-3-chandrapratap3519@gmail.com (mailing list archive)
State Superseded
Headers show
Series t: port reftable/block_test.c to the unit testing framework | expand

Commit Message

Chandra Pratap Aug. 14, 2024, 12:03 p.m. UTC
Used block readers must be released using block_reader_release() to
prevent the occurence of a memory leak. Make test_block_read_write()
conform to this statement.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
 t/unit-tests/t-reftable-block.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Patrick Steinhardt Aug. 15, 2024, 9:40 a.m. UTC | #1
On Wed, Aug 14, 2024 at 05:33:10PM +0530, Chandra Pratap wrote:
> Used block readers must be released using block_reader_release() to
> prevent the occurence of a memory leak. Make test_block_read_write()
> conform to this statement.

Interesting. Didn't the old tests run with the leak checker enabled?

Patrick
Chandra Pratap Aug. 15, 2024, 6:22 p.m. UTC | #2
On Thu, 15 Aug 2024 at 15:10, Patrick Steinhardt <ps@pks.im> wrote:
>
> On Wed, Aug 14, 2024 at 05:33:10PM +0530, Chandra Pratap wrote:
> > Used block readers must be released using block_reader_release() to
> > prevent the occurence of a memory leak. Make test_block_read_write()
> > conform to this statement.
>
> Interesting. Didn't the old tests run with the leak checker enabled?

I think not, I was able to find this error due to the GitHub CI.
diff mbox series

Patch

diff --git a/t/unit-tests/t-reftable-block.c b/t/unit-tests/t-reftable-block.c
index 8ab3ff9ebe..31d179a50a 100644
--- a/t/unit-tests/t-reftable-block.c
+++ b/t/unit-tests/t-reftable-block.c
@@ -103,6 +103,7 @@  static void t_block_read_write(void)
 		block_iter_close(&it);
 	}
 
+	block_reader_release(&br);
 	reftable_record_release(&rec);
 	reftable_block_done(&br.block);
 	strbuf_release(&want);