summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-06-04 14:12:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-04 14:17:43 +0100
commit132f44dce1884c9beed8c5e6588140ee8fa9cfbe (patch)
tree1cd955f3a06de9b3a2c9ebc1114dd74643054ebf /src/cairo-gstate.c
parente89828c5331579d0d4019b6339df09ba1e2aa32e (diff)
valgrindify init/fini routines
Annotate object init/fini routines to detect use-after-free for on-stack/embedded objects.
Diffstat (limited to 'src/cairo-gstate.c')
-rw-r--r--src/cairo-gstate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 6a1fa726..8f6f01b7 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -77,6 +77,8 @@ _cairo_gstate_init (cairo_gstate_t *gstate,
{
cairo_status_t status;
+ VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
+
gstate->next = NULL;
gstate->op = CAIRO_GSTATE_OPERATOR_DEFAULT;
@@ -140,6 +142,8 @@ _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
{
cairo_status_t status;
+ VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
+
gstate->op = other->op;
gstate->tolerance = other->tolerance;
@@ -212,6 +216,8 @@ _cairo_gstate_fini (cairo_gstate_t *gstate)
cairo_pattern_destroy (gstate->source);
gstate->source = NULL;
+
+ VG (VALGRIND_MAKE_MEM_NOACCESS (gstate, sizeof (cairo_gstate_t)));
}
/**
@@ -270,6 +276,7 @@ _cairo_gstate_restore (cairo_gstate_t **gstate, cairo_gstate_t **freelist)
*gstate = top->next;
_cairo_gstate_fini (top);
+ VG (VALGRIND_MAKE_MEM_UNDEFINED (&top->next, sizeof (cairo_gstate_t *)));
top->next = *freelist;
*freelist = top;