[cairo-commit] src/cairo-output-stream.c

Carl Worth cworth at kemper.freedesktop.org
Mon Aug 7 10:28:48 PDT 2006


 src/cairo-output-stream.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

New commits:
diff-tree caa9abc9ee33b660f158ac9f5d420bb39c0b47cb (from 04757a3aa8deeff3265719ebe01b021638990ec6)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Aug 7 10:28:40 2006 -0700

    Fix file handle leak in failure path (bug 7616)

diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 96ff8ce..b089e78 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -459,8 +459,10 @@ _cairo_output_stream_create_for_filename
 	return (cairo_output_stream_t *) &cairo_output_stream_nil_write_error;
 
     stream = malloc (sizeof *stream);
-    if (stream == NULL)
+    if (stream == NULL) {
+	fclose (file);
 	return (cairo_output_stream_t *) &cairo_output_stream_nil;
+    }
 
     _cairo_output_stream_init (&stream->base, stdio_write, stdio_close);
     stream->file = file;


More information about the cairo-commit mailing list