Zero structures before filling them
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 19 May 2010 21:31:39 +0000 (23:31 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 19 May 2010 21:31:39 +0000 (23:31 +0200)
The parse_format function fills a v4l2_mbus_framefmt structure but
doesn't zero it beforehand. This results in some fields being
uninitialized. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
main.c

diff --git a/main.c b/main.c
index ab76c84..40058fe 100644 (file)
--- a/main.c
+++ b/main.c
@@ -223,6 +223,7 @@ static int parse_format(struct v4l2_mbus_framefmt *format, const char *p, char *
        height = strtoul(p, &end, 10);
        *endp = end;
 
+       memset(format, 0, sizeof(*format));
        format->width = width;
        format->height = height;
        format->code = mbus_formats[i].code;