GUAC-236: Invoke init/free handlers as required.

This commit is contained in:
Michael Jumper 2016-02-27 19:14:42 -08:00
parent 578bedcd07
commit f535ccfb54

View File

@ -78,7 +78,9 @@ guacenc_image_stream* guacenc_image_stream_alloc(int mask, int index,
stream->y = y; stream->y = y;
/* Associate with corresponding decoder */ /* 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; return stream;
@ -91,8 +93,9 @@ int guacenc_image_stream_free(guacenc_image_stream* stream) {
return 0; return 0;
/* Invoke free handler for decoder (if associated) */ /* Invoke free handler for decoder (if associated) */
if (stream->decoder != NULL) guacenc_decoder* decoder = stream->decoder;
stream->decoder->free_handler(stream); if (decoder != NULL)
decoder->free_handler(stream);
/* Free actual stream */ /* Free actual stream */
free(stream); free(stream);