[cairo-commit] 2 commits - test/bug-431.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Sep 23 11:10:49 UTC 2023
test/bug-431.c | 4 ++++
1 file changed, 4 insertions(+)
New commits:
commit 6d2d6f312b0aa2afbd1fe39897622adec3e222f1
Merge: 86d7025af 14ae7c7fd
Author: Emmanuele Bassi <ebassi at gmail.com>
Date: Sat Sep 23 11:10:47 2023 +0000
Merge branch 'leak-bug-431' into 'master'
Fix leak in test/bug-431.c
See merge request cairo/cairo!513
commit 14ae7c7fd27790381e3223299384966ab8cf4ee7
Author: Uli Schlachter <psychon at znc.in>
Date: Sun Sep 17 12:26:19 2023 +0200
Fix leak in test/bug-431.c
This test creates surfaces and patterns that it never cleans up. Found via
running:
CAIRO_TEST_TARGET=image valgrind --leak-check=full ./cairo-test-suite -f bug-431
Output before this commit:
==21310==
==21310== HEAP SUMMARY:
==21310== in use at exit: 569,788 bytes in 26 blocks
==21310== total heap usage: 1,523 allocs, 1,497 frees, 2,034,252 bytes allocated
==21310==
==21310== 336 bytes in 2 blocks are definitely lost in loss record 5 of 17
==21310== at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310== by 0x48BE2B0: _cairo_pattern_create_solid (cairo-pattern.c:614)
==21310== by 0x48BE4B1: cairo_pattern_create_rgba (cairo-pattern.c:720)
==21310== by 0x1358C6: draw (bug-431.c:50)
==21310== by 0x129EDB: cairo_test_for_target (cairo-test.c:938)
==21310== by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310== by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310== by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== 278,534 (144 direct, 278,390 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 17
==21310== at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310== by 0x48BE51E: cairo_pattern_create_for_surface (cairo-pattern.c:756)
==21310== by 0x135838: draw (bug-431.c:41)
==21310== by 0x129EDB: cairo_test_for_target (cairo-test.c:938)
==21310== by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310== by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310== by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== 278,534 (144 direct, 278,390 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 17
==21310== at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310== by 0x48BE51E: cairo_pattern_create_for_surface (cairo-pattern.c:756)
==21310== by 0x488274D: _cairo_default_context_set_source_surface (cairo-default-context.c:327)
==21310== by 0x49063DB: cairo_set_source_surface (cairo.c:977)
==21310== by 0x1AC1DD: _cairo_boilerplate_get_image_surface (cairo-boilerplate.c:337)
==21310== by 0x12A486: cairo_test_for_target (cairo-test.c:1145)
==21310== by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310== by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310== by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== LEAK SUMMARY:
==21310== definitely lost: 624 bytes in 4 blocks
==21310== indirectly lost: 556,780 bytes in 16 blocks
==21310== possibly lost: 0 bytes in 0 blocks
==21310== still reachable: 12,384 bytes in 6 blocks
==21310== suppressed: 0 bytes in 0 blocks
==21310== Reachable blocks (those to which a pointer was found) are not shown.
==21310== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==21310==
==21310== For lists of detected and suppressed errors, rerun with: -s
==21310== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Signed-off-by: Uli Schlachter <psychon at znc.in>
diff --git a/test/bug-431.c b/test/bug-431.c
index 663fe0c45..717b03b7f 100644
--- a/test/bug-431.c
+++ b/test/bug-431.c
@@ -53,6 +53,10 @@ draw (cairo_t *cr, int width, int height)
cairo_mask(cr, mask_pattern);
cairo_restore(cr);
+ cairo_surface_destroy (png_surface);
+ cairo_pattern_destroy (png_pattern);
+ cairo_pattern_destroy (mask_pattern);
+
return CAIRO_TEST_SUCCESS;
}
More information about the cairo-commit
mailing list