diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c index 9f94a901ec..300ee77316 100644 --- a/libavformat/apvdec.c +++ b/libavformat/apvdec.c @@ -225,7 +225,9 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt) } ret = av_get_packet(s->pb, pkt, au_size); - pkt->flags = AV_PKT_FLAG_KEY; + if (ret < 0) + return ret; + pkt->flags = AV_PKT_FLAG_KEY; signature = AV_RB32(pkt->data); if (signature != APV_SIGNATURE) { @@ -233,7 +235,7 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_INVALIDDATA; } - return ret; + return 0; } const FFInputFormat ff_apv_demuxer = {