Commit 02ae52db authored by James Almer's avatar James Almer

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: 's avatarJames Almer <jamrial@gmail.com>
parent 265ec559
...@@ -867,13 +867,9 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -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)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment