diff --git a/src/guacenc/encode.c b/src/guacenc/encode.c index 854c5c60..2d74a9b6 100644 --- a/src/guacenc/encode.c +++ b/src/guacenc/encode.c @@ -63,8 +63,11 @@ static int guacenc_read_instructions(guacenc_display* display, /* Continuously read and handle all instructions */ while (!guac_parser_read(parser, socket, -1)) { - guacenc_handle_instruction(display, parser->opcode, - parser->argc, parser->argv); + if (guacenc_handle_instruction(display, parser->opcode, + parser->argc, parser->argv)) { + guac_parser_free(parser); + return 1; + } } /* Fail on read/parse error */