diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-04 00:38:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-04 00:42:30 +0100 |
commit | 8ad56b308ae8bbecfe9873c21551a6d4b2302420 (patch) | |
tree | a9c8791e8c30f70fc24a1b1ade069e54c23d98be /src/cairo-font-options.c | |
parent | 66664596559c55913fb0b9c8784fe8ab862c217b (diff) | |
download | cairo-8ad56b308ae8bbecfe9873c21551a6d4b2302420.tar.gz |
[malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
Diffstat (limited to 'src/cairo-font-options.c')
-rw-r--r-- | src/cairo-font-options.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c index 33b021da1..b3a5660c3 100644 --- a/src/cairo-font-options.c +++ b/src/cairo-font-options.c @@ -86,10 +86,13 @@ _cairo_font_options_init_copy (cairo_font_options_t *options, cairo_font_options_t * cairo_font_options_create (void) { - cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t)); + cairo_font_options_t *options; - if (!options) + options = malloc (sizeof (cairo_font_options_t)); + if (!options) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return (cairo_font_options_t *)&_cairo_font_options_nil; + } _cairo_font_options_init_default (options); @@ -119,8 +122,10 @@ cairo_font_options_copy (const cairo_font_options_t *original) return (cairo_font_options_t *)&_cairo_font_options_nil; options = malloc (sizeof (cairo_font_options_t)); - if (!options) + if (!options) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return (cairo_font_options_t *)&_cairo_font_options_nil; + } _cairo_font_options_init_copy (options, original); |