From fa771a7f85d6d07ed64db438c8f07cd6b3f65e3e Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 11 Oct 2020 22:11:17 +0200 Subject: [PATCH] [tests] Fix memory leak in test To make valgrind bot happy. --- test/api/test-buffer.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index 6196bc841..76bae3ecb 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -892,16 +892,17 @@ test_buffer_serialize_deserialize (void) retval = hb_buffer_deserialize_unicode (b, test->contents, -1, NULL, test->format); - if (test->success == 0) - continue; // Expected parse failure, got one, don't round-trip + // Expected parse failure, got one, don't round-trip + if (test->success != 0) + { + num_glyphs = hb_buffer_get_length (b); + g_assert_cmpint (num_glyphs, ==, test->num_items); - num_glyphs = hb_buffer_get_length (b); - g_assert_cmpint (num_glyphs, ==, test->num_items); - - hb_buffer_serialize_unicode (b, 0, num_glyphs, round_trip, - sizeof(round_trip), &consumed, test->format, - HB_BUFFER_SERIALIZE_FLAG_DEFAULT); - g_assert_cmpstr (round_trip, ==, test->contents); + hb_buffer_serialize_unicode (b, 0, num_glyphs, round_trip, + sizeof(round_trip), &consumed, test->format, + HB_BUFFER_SERIALIZE_FLAG_DEFAULT); + g_assert_cmpstr (round_trip, ==, test->contents); + } hb_buffer_destroy (b);