[cairo-commit] src/cairo-scaled-font-subsets.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Jun 29 06:34:46 PDT 2008
src/cairo-scaled-font-subsets.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit 6227d808446a0212d3872be9d09d67e3ce644cd3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Jun 29 14:32:17 2008 +0100
[cairo-scaled-font-subsets] And free the allocated memory on failure.
Why, oh why, did I only spot this when reading cairo-commit?
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index c0da4da..ff6d5bf 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -810,8 +810,14 @@ _cairo_scaled_font_subsets_foreach_internal (cairo_scaled_font_subsets_t
collection.glyphs = _cairo_malloc_ab (collection.glyphs_size, sizeof(unsigned long));
collection.utf8 = _cairo_malloc_ab (collection.glyphs_size, sizeof(char *));
- if (collection.glyphs == NULL || collection.utf8 == NULL)
+ if (collection.glyphs == NULL || collection.utf8 == NULL) {
+ if (collection.glyphs != NULL)
+ free (collection.glyphs);
+ if (collection.utf8 != NULL)
+ free (collection.utf8);
+
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ }
collection.font_subset_callback = font_subset_callback;
collection.font_subset_callback_closure = closure;
More information about the cairo-commit
mailing list