From f535ccfb54411816109264cc203ee4ecca8847e8 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 27 Feb 2016 19:14:42 -0800 Subject: [PATCH] GUAC-236: Invoke init/free handlers as required. --- src/guacenc/image-stream.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/guacenc/image-stream.c b/src/guacenc/image-stream.c index 0872effc..7475d471 100644 --- a/src/guacenc/image-stream.c +++ b/src/guacenc/image-stream.c @@ -78,7 +78,9 @@ guacenc_image_stream* guacenc_image_stream_alloc(int mask, int index, stream->y = y; /* Associate with corresponding decoder */ - stream->decoder = guacenc_get_decoder(mimetype); + guacenc_decoder* decoder = stream->decoder = guacenc_get_decoder(mimetype); + if (decoder != NULL) + decoder->init_handler(stream); return stream; @@ -91,8 +93,9 @@ int guacenc_image_stream_free(guacenc_image_stream* stream) { return 0; /* Invoke free handler for decoder (if associated) */ - if (stream->decoder != NULL) - stream->decoder->free_handler(stream); + guacenc_decoder* decoder = stream->decoder; + if (decoder != NULL) + decoder->free_handler(stream); /* Free actual stream */ free(stream);