提交 02ae52db 编写于 作者: J 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: NJames Almer <jamrial@gmail.com>
上级 265ec559
......@@ -867,13 +867,9 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
continue;
}
if (!pkt->buf) {
AVPacket tmp = { 0 };
err = av_packet_ref(&tmp, pkt);
if (err < 0)
return err;
*pkt = tmp;
}
err = av_packet_make_refcounted(pkt);
if (err < 0)
return err;
if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
(pkt->flags & AV_PKT_FLAG_CORRUPT)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册