diff --git a/src/t_bitwriter.c b/src/t_bitwriter.c
index 6b9b7051fa480b47e9cf173e29d865bdbc4a8943..0d2a8c0fde798d90ab60a9663c34c6744be11697 100644
--- a/src/t_bitwriter.c
+++ b/src/t_bitwriter.c
@@ -32,6 +32,8 @@ void run_bitwriter_test(bitwriter_test_elem data[], char flags) {
   for (i = 0; data[i].nbits; i++) {
     g_check_cmp_uint64((uint64_t)h_read_bits(&input, data[i].nbits, FALSE), ==,  data[i].data);
   }
+
+  h_bit_writer_free(w);
 }
 
 static void test_bitwriter_ints(void) {