diff mbox series

[FFmpeg-devel,1/2] avcodec/v4l2_context: Use av_freep

Message ID 20200406042203.10681-1-andriy.gelman@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/v4l2_context: Use av_freep | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andriy Gelman April 6, 2020, 4:22 a.m. UTC
From: Andriy Gelman <andriy.gelman@gmail.com>

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
---
 libavcodec/v4l2_context.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Andreas Rheinhardt April 6, 2020, 7:37 a.m. UTC | #1
Andriy Gelman:
> From: Andriy Gelman <andriy.gelman@gmail.com>
> 
> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
> ---
>  libavcodec/v4l2_context.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
> index 8110bbb555..31af10d28e 100644
> --- a/libavcodec/v4l2_context.c
> +++ b/libavcodec/v4l2_context.c
> @@ -685,8 +685,7 @@ void ff_v4l2_context_release(V4L2Context* ctx)
>      if (ret)
>          av_log(logger(ctx), AV_LOG_WARNING, "V4L2 failed to unmap the %s buffers\n", ctx->name);
>  
> -    av_free(ctx->buffers);
> -    ctx->buffers = NULL;
> +    av_freep(&ctx->buffers);
>  }
>  
>  int ff_v4l2_context_init(V4L2Context* ctx)
> @@ -743,8 +742,7 @@ int ff_v4l2_context_init(V4L2Context* ctx)
>  error:
>      v4l2_release_buffers(ctx);
>  
> -    av_free(ctx->buffers);
> -    ctx->buffers = NULL;
> +    av_freep(&ctx->buffers);
>  
>      return ret;
>  }
> 
LGTM.

- Andreas
Andriy Gelman April 9, 2020, 1:55 a.m. UTC | #2
On Mon, 06. Apr 09:37, Andreas Rheinhardt wrote:
> Andriy Gelman:
> > From: Andriy Gelman <andriy.gelman@gmail.com>
> > 
> > Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
> > ---
> >  libavcodec/v4l2_context.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
> > index 8110bbb555..31af10d28e 100644
> > --- a/libavcodec/v4l2_context.c
> > +++ b/libavcodec/v4l2_context.c
> > @@ -685,8 +685,7 @@ void ff_v4l2_context_release(V4L2Context* ctx)
> >      if (ret)
> >          av_log(logger(ctx), AV_LOG_WARNING, "V4L2 failed to unmap the %s buffers\n", ctx->name);
> >  
> > -    av_free(ctx->buffers);
> > -    ctx->buffers = NULL;
> > +    av_freep(&ctx->buffers);
> >  }
> >  
> >  int ff_v4l2_context_init(V4L2Context* ctx)
> > @@ -743,8 +742,7 @@ int ff_v4l2_context_init(V4L2Context* ctx)
> >  error:
> >      v4l2_release_buffers(ctx);
> >  
> > -    av_free(ctx->buffers);
> > -    ctx->buffers = NULL;
> > +    av_freep(&ctx->buffers);
> >  
> >      return ret;
> >  }
> > 
> LGTM.

Applied.

Thanks
diff mbox series

Patch

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 8110bbb555..31af10d28e 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -685,8 +685,7 @@  void ff_v4l2_context_release(V4L2Context* ctx)
     if (ret)
         av_log(logger(ctx), AV_LOG_WARNING, "V4L2 failed to unmap the %s buffers\n", ctx->name);
 
-    av_free(ctx->buffers);
-    ctx->buffers = NULL;
+    av_freep(&ctx->buffers);
 }
 
 int ff_v4l2_context_init(V4L2Context* ctx)
@@ -743,8 +742,7 @@  int ff_v4l2_context_init(V4L2Context* ctx)
 error:
     v4l2_release_buffers(ctx);
 
-    av_free(ctx->buffers);
-    ctx->buffers = NULL;
+    av_freep(&ctx->buffers);
 
     return ret;
 }