On 9/20/2019 5:39 PM, Andreas Rheinhardt wrote: > From: James Almer <jamr...@gmail.com> > > Demuxers may have allocated a packet before encountering an error and > aborting. > > Fixes ticket #8150 > > Signed-off-by: James Almer <jamr...@gmail.com> > --- > Earlier versions of this patchset used av_init_packet() together with > setting the size and data to zero/NULL. This would have caused memleaks > when the packet contained data that needs to be freed/unreferenced, > whereas this approach here runs the risk of double freeing. I consider > the risk of the latter much lower than the risk of the former and have > therefore included this patch in this patchset. > > libavformat/utils.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 652642a71b..e348df3269 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -854,6 +854,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) > av_init_packet(pkt); > ret = s->iformat->read_packet(s, pkt); > if (ret < 0) { > + av_packet_unref(pkt); > + > /* Some demuxers return FFERROR_REDO when they consume > data and discard it (ignored streams, junk, extradata). > We must re-call the demuxer to get the real packet. */
Applied. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".