idroqdec: fix leaking pkt on failure

The code calls av_new_packet a few lines above and the allocated memory
has to be freed in case of an error.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2016-11-29 00:43:27 +01:00
parent 94d3d98246
commit c0175fa92b

View File

@ -222,8 +222,10 @@ static int roq_read_packet(AVFormatContext *s,
pkt->pos= avio_tell(pb);
ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size)
if (ret != chunk_size) {
av_packet_unref(pkt);
ret = AVERROR(EIO);
}
packet_read = 1;
break;