[cairo-commit] Branch '1.0' - src/cairo-output-stream.c

Carl Worth cworth at kemper.freedesktop.org
Mon Mar 13 12:17:02 PST 2006


 src/cairo-output-stream.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

New commits:
diff-tree 13b919f126427f8038cd9e76d6195494167ba503 (from 46646cf2b1e392caced989a9adb65b50eac86ba3)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Mar 13 12:05:13 2006 -0800

    cairo-output-stream: Don't dereference a NULL pointer due to OOM.
    
    This close bug #6176:
    
    	Null pointer dereference on OOM in _cairo_output_stream_create_for_file()
    	https://bugs.freedesktop.org/show_bug.cgi?id=6176
    (cherry picked from c780f4a5624f27a6cbf7829e10e8cd3544ae4f38 commit)

diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index afb4d42..30aad09 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -305,9 +305,11 @@ _cairo_output_stream_create_for_file (co
 	return NULL;
     
     stream = _cairo_output_stream_create (stdio_write, fp);
-    if (stream == NULL)
+
+    if (stream)
+	stream->owns_closure_is_file = TRUE;
+    else
 	fclose (fp);
-    stream->owns_closure_is_file = TRUE;
 
     return stream;
 }


More information about the cairo-commit mailing list