[FFmpeg-devel] [PATCH 1/2] lavd/v4l2: fully init an ioctl argument.

Giorgio Vazzana mywing81 at gmail.com
Thu Mar 28 12:42:11 CET 2013


2013/3/27 Nicolas George <nicolas.george at normalesup.org>:
> Silence a valgrind warning about uninitialized memory.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavdevice/v4l2.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index c041424..7a6388a 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -951,11 +951,10 @@ static int v4l2_read_header(AVFormatContext *s1)
>      }
>
>      if (!s->width && !s->height) {
> -        struct v4l2_format fmt;
> +        struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
>
>          av_log(s1, AV_LOG_VERBOSE,
>                 "Querying the device for the current frame size\n");
> -        fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
>          if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
>              res = AVERROR(errno);
>              av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res));
> --
> 1.7.10.4

LGTM, thanks.


More information about the ffmpeg-devel mailing list