diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-04-16 17:19:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-04-23 09:22:51 +0100 |
commit | 1ae2ddc1dd4c90d50b8c57c4de677f8ab96b1fa2 (patch) | |
tree | 3be2da997e6f7da5df94472e0c700bb5abe00086 /src/cairo-pen.c | |
parent | 817589e1967ebdd5e5bda1781eb76010fd8c37dc (diff) |
[memfault] Manually inject faults when using stack allocations
Ensure that no assumptions are made that a small allocation will succeed
by manually injecting faults when we may be simply allocating from an
embedded memory pool.
The main advantage in manual fault injection is improved code coverage -
from within the test suite most allocations are handled by the embedded
memory pools.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r-- | src/cairo-pen.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c index 9d5e8959..eb66b1a0 100644 --- a/src/cairo-pen.c +++ b/src/cairo-pen.c @@ -55,6 +55,9 @@ _cairo_pen_init (cairo_pen_t *pen, int i; int reflect; + if (CAIRO_INJECT_FAULT ()) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + pen->radius = radius; pen->tolerance = tolerance; @@ -109,6 +112,9 @@ _cairo_pen_init_copy (cairo_pen_t *pen, const cairo_pen_t *other) { *pen = *other; + if (CAIRO_INJECT_FAULT ()) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + pen->vertices = pen->vertices_embedded; if (pen->num_vertices) { if (pen->num_vertices > ARRAY_LENGTH (pen->vertices_embedded)) { @@ -132,6 +138,9 @@ _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points) int num_vertices; int i; + if (CAIRO_INJECT_FAULT ()) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + num_vertices = pen->num_vertices + num_points; if (num_vertices > ARRAY_LENGTH (pen->vertices_embedded) || pen->vertices != pen->vertices_embedded) |