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-unicode.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-unicode.c')
-rw-r--r-- | src/cairo-unicode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cairo-unicode.c b/src/cairo-unicode.c index 1d1c00a9f..8ee6d246a 100644 --- a/src/cairo-unicode.c +++ b/src/cairo-unicode.c @@ -241,8 +241,10 @@ _cairo_utf8_to_ucs4 (const unsigned char *str, } str32 = _cairo_malloc_ab (n_chars + 1, sizeof (uint32_t)); - if (!str32) + if (!str32) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return CAIRO_STATUS_NO_MEMORY; + } in = str; for (i=0; i < n_chars; i++) { @@ -308,8 +310,10 @@ _cairo_utf8_to_utf16 (const unsigned char *str, } str16 = _cairo_malloc_ab (n16 + 1, sizeof (uint16_t)); - if (!str16) + if (!str16) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return CAIRO_STATUS_NO_MEMORY; + } in = str; for (i = 0; i < n16;) { |