From e6102dbe028ca93db936b2f4cd6368e2ba0a2209 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 26 Jan 2009 14:00:13 +0000 Subject: [PATCH] [png] Avoid a double free of the memory stream after error. _cairo_memory_stream_destroy() finalizes the stream even if the stream was in error and that error is reported back to the caller - so ensure we don't try to free the stream again. --- src/cairo-png.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cairo-png.c b/src/cairo-png.c index fd16c4dc7..58e38cb55 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -655,12 +655,12 @@ read_png (struct png_read_closure_t *png_closure) status = _cairo_memory_stream_destroy (png_closure->png_data, &mime_data, &mime_data_length); + png_closure->png_data = NULL; if (unlikely (status)) { cairo_surface_destroy (surface); surface = _cairo_surface_create_in_error (status); goto BAIL; } - png_closure->png_data = NULL; status = cairo_surface_set_mime_data (surface, CAIRO_MIME_TYPE_PNG,