[cairo-commit] 2 commits - test/api-special-cases.c test/cairo-test-runner.c

Bryce Harrington bryce at kemper.freedesktop.org
Sat Dec 6 17:38:27 PST 2014


 test/api-special-cases.c |    4 +++-
 test/cairo-test-runner.c |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4a225fca5f121c31ddaa0af80a13bf95a7f21a5b
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Thu Nov 20 17:22:30 2014 +0100

    test: Free test list
    
    When running the cairo-test-suite, valgrind reports each of the
    registered test as a leak, because they are _list_prepend()'ed, but
    the tests list is never _list_free()'d.
    
    Fixes the following valgrind error:
    
    malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    cairo_boilerplate_xmalloc (cairo-boilerplate-system.c:47)
    cairo_test_register (cairo-test-runner.c:131)
    _cairo_test_runner_register_tests (cairo-test-constructors.c:1112)
    main (cairo-test-runner.c:714)
    
    Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>

diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index 3fb3ae5..f9e7d47 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -1096,6 +1096,7 @@ main (int argc, char **argv)
 
     _runner_print_results (&runner);
 
+    _list_free (tests);
     free (target_status);
     return _runner_fini (&runner);
 }
commit 9806f437b42056124314976f35a2d32cefa508a8
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Thu Nov 20 17:22:31 2014 +0100

    test: Release owned pattern
    
    The pattern created by cairo_pattern_create_rgb() is owned by the
    caller, hence it needs to be released.
    
    Fixes the following valgrind error:
    
    malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    _cairo_pattern_create_solid (cairo-pattern.c:605)
    _cairo_pattern_create_in_error (cairo-pattern.c:628)
    cairo_pop_group (cairo.c:552)
    test_cairo_push_group (api-special-cases.c:157)
    preamble (api-special-cases.c:1766)
    main (cairo-test-runner.c:228)
    
    Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>

diff --git a/test/api-special-cases.c b/test/api-special-cases.c
index e861152..c4a754d 100644
--- a/test/api-special-cases.c
+++ b/test/api-special-cases.c
@@ -181,7 +181,9 @@ test_cairo_set_operator (cairo_t *cr)
 static cairo_test_status_t
 test_cairo_set_source (cairo_t *cr)
 {
-    cairo_set_source (cr, cairo_pattern_create_rgb (0, 0, 0));
+    cairo_pattern_t *source = cairo_pattern_create_rgb (0, 0, 0);
+    cairo_set_source (cr, source);
+    cairo_pattern_destroy (source);
 
     return CAIRO_TEST_SUCCESS;
 }


More information about the cairo-commit mailing list