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>
pull/283/head
James Almer 7 years ago
parent 265ec55983
commit 02ae52db87
  1. 10
      libavformat/utils.c

@ -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)) {

Loading…
Cancel
Save