On Sun, Jun 9, 2019 at 5:41 AM Michael Niedermayer <mich...@niedermayer.cc>
wrote:

> On Sat, Jun 08, 2019 at 06:53:58AM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang <lance.lmw...@gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmw...@gmail.com>
> > ---
> >  libavfilter/vf_find_rect.c | 40 +++++++++++++++++++++++++++-------------
> >  1 file changed, 27 insertions(+), 13 deletions(-)
> >
> > diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
> > index d7e6579..6fe12fe 100644
> > --- a/libavfilter/vf_find_rect.c
> > +++ b/libavfilter/vf_find_rect.c
> > @@ -28,6 +28,7 @@
> >  #include "internal.h"
> >
> >  #include "lavfutils.h"
> > +#include "lswsutils.h"
> >
> >  #define MAX_MIPMAPS 5
> >
> > @@ -235,8 +236,6 @@ static av_cold void uninit(AVFilterContext *ctx)
> >          av_frame_free(&foc->haystack_frame[i]);
> >      }
> >
> > -    if (foc->obj_frame)
> > -        av_freep(&foc->obj_frame->data[0]);
> >      av_frame_free(&foc->obj_frame);
> >  }
>
> this alone will leak
>
> something like:
> foc->obj_frame->buf[0] =
>         av_buffer_create(foc->obj_frame->data[0],
>                          foc->obj_frame->linesize[0] *
> foc->obj_frame->height,
>                          av_buffer_default_free,
>                          NULL,
>                          0);
>
> would be needed, but maybe theres a cleaner way to do this
> like having a function that does all this in one step and produces a normal
> AVFrame. I think more filters could benefit from this if theres nothing
> like it yet ...
>
>
I misunderstand by another code review and think the buffer is freed by
av_free_frame. I'll revert it back in the update patch.



> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Its not that you shouldnt use gotos but rather that you should write
> readable code and code with gotos often but not always is less readable
> _______________________________________________
> 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".
_______________________________________________
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".

Reply via email to