diff options
-rw-r--r-- | src/cairo-output-stream.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c index 96ff8ce0..b089e789 100644 --- a/src/cairo-output-stream.c +++ b/src/cairo-output-stream.c @@ -459,8 +459,10 @@ _cairo_output_stream_create_for_filename (const char *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; |