diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 388639a110..2d5700a51e 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -677,7 +677,8 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub_ptr, ret = AVERROR_INVALIDDATA; break; } - if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) { + if (ret < 0 && (ret == AVERROR(ENOMEM) || + avctx->err_recognition & AV_EF_EXPLODE)) { avsubtitle_free(data); *got_sub_ptr = 0; return ret;