summaryrefslogtreecommitdiff
path: root/test/user-font-rescale.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-05-04 17:01:35 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-04 18:26:06 +0100
commitded7be0b9ce12f8d4a84c8c9dd622d92fe347a34 (patch)
tree60d6d612380c0fd946f64271a169cf5e14814bef /test/user-font-rescale.c
parentb0052c52153376400a30dca1d67f4aca9735cc09 (diff)
downloadcairo-ded7be0b9ce12f8d4a84c8c9dd622d92fe347a34.tar.gz
test/user-font-rescale: Use after free and check for memfault.
Diffstat (limited to 'test/user-font-rescale.c')
-rw-r--r--test/user-font-rescale.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/user-font-rescale.c b/test/user-font-rescale.c
index 54b3a20ca..8d2e8978e 100644
--- a/test/user-font-rescale.c
+++ b/test/user-font-rescale.c
@@ -258,10 +258,11 @@ get_user_font_face (cairo_font_face_t *substitute_font,
&glyphs, &num_glyphs,
NULL, NULL, NULL);
cairo_font_options_destroy (options);
- cairo_scaled_font_destroy (measure);
- if (status)
+ if (status) {
+ cairo_scaled_font_destroy (measure);
return status;
+ }
/* find the glyph range the text covers */
max_index = glyphs[0].index;
@@ -282,11 +283,16 @@ get_user_font_face (cairo_font_face_t *substitute_font,
widths[glyphs[i].index - min_index] = extents.x_advance;
}
+ status = cairo_scaled_font_status (measure);
+ cairo_scaled_font_destroy (measure);
cairo_glyph_free (glyphs);
- status = create_rescaled_font (substitute_font,
- min_index, count, widths,
- out);
+ if (status == CAIRO_STATUS_SUCCESS) {
+ status = create_rescaled_font (substitute_font,
+ min_index, count, widths,
+ out);
+ }
+
free (widths);
return status;
}