> On Jun 28, 2020, at 5:09 AM, Andreas Rheinhardt > <andreas.rheinha...@gmail.com> wrote: > > Zhao Zhili: >> Remove the check on dv_demux since dv_fctx will leak if allocate >> dv_demux failed. >> --- >> libavformat/mov.c | 7 +++---- >> 1 file changed, 3 insertions(+), 4 deletions(-) >> >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index adc52de947..f179b6efdd 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -7357,10 +7357,9 @@ static int mov_read_close(AVFormatContext *s) >> av_freep(&sc->coll); >> } >> >> - if (mov->dv_demux) { >> - avformat_free_context(mov->dv_fctx); >> - mov->dv_fctx = NULL; >> - } >> + av_freep(&mov->dv_demux); >> + avformat_free_context(mov->dv_fctx); >> + mov->dv_fctx = NULL; >> >> if (mov->meta_keys) { >> for (i = 1; i < mov->meta_keys_count; i++) { >> > Do you have a sample for this? I am asking because there are more > memleaks related to dv audio and I have a patch [1] for them, but I > never found any sample for dv in mov/mp4, so it was never applied.
I don’t have samples either. It took some time with debugger and valgrind to verify the leak exist and the fix is valid. > > If I am not mistaken, then you are not only fixing a leak of dv_fctx in > case allocation of dv_demux failed; you are also fixing a leak of > dv_demux itself in the ordinary case where it could be successfully > allocated. This should be reflected in the commit message. Yes, the commit message only mentioned the nonobvious one. Will fix it in a new patch. > > - Andreas > > [1]: > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20190916155502.17579-3-andreas.rheinha...@gmail.com/ > > <https://patchwork.ffmpeg.org/project/ffmpeg/patch/20190916155502.17579-3-andreas.rheinha...@gmail.com/> > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel> > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org <mailto:ffmpeg-devel-requ...@ffmpeg.org> with > subject "unsubscribe". _______________________________________________ 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".