summaryrefslogtreecommitdiff
path: root/src/cairo-traps.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-04-16 17:19:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-04-23 09:22:51 +0100
commit1ae2ddc1dd4c90d50b8c57c4de677f8ab96b1fa2 (patch)
tree3be2da997e6f7da5df94472e0c700bb5abe00086 /src/cairo-traps.c
parent817589e1967ebdd5e5bda1781eb76010fd8c37dc (diff)
downloadcairo-1ae2ddc1dd4c90d50b8c57c4de677f8ab96b1fa2.tar.gz
[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-traps.c')
-rw-r--r--src/cairo-traps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cairo-traps.c b/src/cairo-traps.c
index faf7722f6..fed3f101c 100644
--- a/src/cairo-traps.c
+++ b/src/cairo-traps.c
@@ -131,6 +131,11 @@ _cairo_traps_grow (cairo_traps_t *traps)
cairo_trapezoid_t *new_traps;
int new_size = 2 * MAX (traps->traps_size, 16);
+ if (CAIRO_INJECT_FAULT ()) {
+ traps->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ return FALSE;
+ }
+
if (traps->traps == traps->traps_embedded) {
new_traps = _cairo_malloc_ab (new_size, sizeof (cairo_trapezoid_t));
if (new_traps != NULL)