summaryrefslogtreecommitdiff
path: root/src/cairo-output-stream.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-04 19:10:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-10-04 20:07:58 +0100
commit353c2ab5c0e10f267a1adf3957b5d6af4e6a2e29 (patch)
tree2fa8c4741cda7db0f786a8f6d6ad9662b49511a7 /src/cairo-output-stream.c
parent7cc7bf09c1a61f407fdb054640ebf24039f985db (diff)
[cairo-output-stream] Guard against destroying the nil streams.
Add a guard to return early if we attempt to call _cairo_output_stream_destroy() on the nil cairo_output_stream_t streams.
Diffstat (limited to 'src/cairo-output-stream.c')
-rw-r--r--src/cairo-output-stream.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 323bd0645..5bce0e343 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -166,6 +166,12 @@ _cairo_output_stream_destroy (cairo_output_stream_t *stream)
if (stream == NULL)
return _cairo_error (CAIRO_STATUS_NULL_POINTER);
+ if (stream == &_cairo_output_stream_nil ||
+ stream == &_cairo_output_stream_nil_write_error)
+ {
+ return stream->status;
+ }
+
status = _cairo_output_stream_fini (stream);
free (stream);