1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avformat/utils: use av_packet_make_refcounted to ensure packets are ref counted

Simplifies code, while also fixing a potential leak of side data in pkt.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2018-03-24 22:33:32 -03:00
parent 265ec55983
commit 02ae52db87

View File

@@ -867,13 +867,9 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
continue; continue;
} }
if (!pkt->buf) { err = av_packet_make_refcounted(pkt);
AVPacket tmp = { 0 }; if (err < 0)
err = av_packet_ref(&tmp, pkt); return err;
if (err < 0)
return err;
*pkt = tmp;
}
if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) && if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
(pkt->flags & AV_PKT_FLAG_CORRUPT)) { (pkt->flags & AV_PKT_FLAG_CORRUPT)) {