diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-17 10:42:37 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-18 09:44:33 +0000 |
commit | dc176d88ac03ae71fc32abb27329a35650801d99 (patch) | |
tree | 5f714028de8f7728126922bd1ad22ee6fb453448 /test/show-glyphs-many.c | |
parent | a4b44ca89eb9975e6af2913e50ec3c3eb566cfdd (diff) |
[test] Trivial leak on error in show-glyphs-many.
Free the allocated glyph array after failure.
Diffstat (limited to 'test/show-glyphs-many.c')
-rw-r--r-- | test/show-glyphs-many.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/show-glyphs-many.c b/test/show-glyphs-many.c index 497db584..9657e283 100644 --- a/test/show-glyphs-many.c +++ b/test/show-glyphs-many.c @@ -130,7 +130,7 @@ draw (cairo_t *cr, int width, int height) for (utf8 = characters; *utf8 != NULL; utf8++) { status = get_glyph (cr, *utf8, &glyphs[0]); if (status) - return status; + goto BAIL; if (glyphs[0].index) { glyphs[0].x = 1.0; @@ -145,21 +145,22 @@ draw (cairo_t *cr, int width, int height) /* we can pack ~21k 1-byte glyphs into a single XRenderCompositeGlyphs8 */ status = get_glyph (cr, "m", &glyphs[0]); if (status) - return status; + goto BAIL; for (i=1; i < 21500; i++) glyphs[i] = glyphs[0]; /* so check expanding the current 1-byte request for 2-byte glyphs */ status = get_glyph (cr, "μ", &glyphs[i]); if (status) - return status; + goto BAIL; for (j=i+1; j < NUM_GLYPHS; j++) glyphs[j] = glyphs[i]; cairo_show_glyphs (cr, glyphs, NUM_GLYPHS); - + + BAIL: free(glyphs); - return CAIRO_TEST_SUCCESS; + return status; } CAIRO_TEST (show_glyphs_many, |