From b61931640d384707a6fc48f9ba4a4f2ddf675c32 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 4 Oct 2007 19:12:10 +0100 Subject: [PATCH] [cairo-ps-surface] Check the creation of output streams. Check for allocation errors during the creation of the output streams. --- src/cairo-ps-surface.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 23a478c50..7bf2af5de 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -271,6 +271,9 @@ _cairo_ps_surface_emit_path (cairo_ps_surface_t *surface, ps_path_info_t path_info; word_wrap = _word_wrap_stream_create (stream, 79); + status = _cairo_output_stream_get_status (word_wrap); + if (status) + return status; path_info.surface = surface; path_info.stream = word_wrap; @@ -283,8 +286,6 @@ _cairo_ps_surface_emit_path (cairo_ps_surface_t *surface, _cairo_ps_surface_path_close_path, &path_info); - if (status == CAIRO_STATUS_SUCCESS) - status = _cairo_output_stream_get_status (word_wrap); status2 = _cairo_output_stream_destroy (word_wrap); if (status == CAIRO_STATUS_SUCCESS) status = status2; @@ -1675,7 +1676,16 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t *surface, "/%sData [\n", name); string_array_stream = _string_array_stream_create (surface->stream); + status = _cairo_output_stream_get_status (string_array_stream); + if (status) + goto bail3; + base85_stream = _cairo_base85_stream_create (string_array_stream); + status = _cairo_output_stream_get_status (base85_stream); + if (status) { + status2 = _cairo_output_stream_destroy (string_array_stream); + goto bail3; + } _cairo_output_stream_write (base85_stream, compressed, compressed_size); @@ -2354,6 +2364,10 @@ _cairo_ps_surface_show_glyphs (void *abstract_surface, _cairo_output_stream_printf (surface->stream, "<%02x> S\n", glyph_ids[i].glyph_id); } else { word_wrap = _word_wrap_stream_create (surface->stream, 79); + status = _cairo_output_stream_get_status (word_wrap); + if (status) + goto fail; + _cairo_output_stream_printf (word_wrap, "<"); for (j = i; j < last+1; j++) _cairo_output_stream_printf (word_wrap, "%02x", glyph_ids[j].glyph_id);