diff -up libwebp-0.3.0/src/dec/idec.c.rhbz-1956843 libwebp-0.3.0/src/dec/idec.c --- libwebp-0.3.0/src/dec/idec.c.rhbz-1956843 2021-05-17 10:44:13.670402403 +0200 +++ libwebp-0.3.0/src/dec/idec.c 2021-05-17 10:45:31.035742375 +0200 @@ -241,10 +241,8 @@ static void RestoreContext(const MBConte static VP8StatusCode IDecError(WebPIDecoder* const idec, VP8StatusCode error) { if (idec->state_ == STATE_VP8_DATA) { - VP8Io* const io = &idec->io_; - if (io->teardown) { - io->teardown(io); - } + // Synchronize the thread, clean-up and check for errors. + VP8ExitCritical((VP8Decoder*)idec->dec_, &idec->io_); } idec->state_ = STATE_ERROR; return error;