summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-08-07 10:28:40 -0700
committerCarl Worth <cworth@cworth.org>2006-08-07 10:28:40 -0700
commitcaa9abc9ee33b660f158ac9f5d420bb39c0b47cb (patch)
tree10e2bb9eb3f469c3da3bfbb4cf1aca763f6a9341
parent04757a3aa8deeff3265719ebe01b021638990ec6 (diff)
Fix file handle leak in failure path (bug 7616)
-rw-r--r--src/cairo-output-stream.c4
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;