summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f8926bdc64..fd96b9d959 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -413,6 +413,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
continue;
}
+ if (!pkt->buf) {
+ AVPacket tmp = { 0 };
+ ret = av_packet_ref(&tmp, pkt);
+ if (ret < 0)
+ return ret;
+ *pkt = tmp;
+ }
+
if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
(pkt->flags & AV_PKT_FLAG_CORRUPT)) {
av_log(s, AV_LOG_WARNING,