Commit 8d0960ec authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

sys/v4l2/: Init some structs to zero before we pass them to ioctl, which...

sys/v4l2/: Init some structs to zero before we pass them to ioctl, which avoids valgrind warnings.  Also fix a small ...

Original commit message from CVS:
* sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list):
Init some structs to zero before we pass them to ioctl, which
avoids valgrind warnings.  Also fix a small memory leak.
parent dbf28d28
2007-12-11 Tim-Philipp Müller <tim at centricular dot net>
* sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list):
Init some structs to zero before we pass them to ioctl, which
avoids valgrind warnings. Also fix a small memory leak.
2007-12-11 Wim Taymans <wim.taymans@collabora.co.uk>
 
Patch by: Wouter Cloetens <wouter at mind dot be>
......
......@@ -102,7 +102,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
GST_DEBUG_OBJECT (e, " channels");
/* and now, the channels */
for (n = 0;; n++) {
struct v4l2_input input;
struct v4l2_input input = { 0, };
GstV4l2TunerChannel *v4l2channel;
GstTunerChannel *channel;
......@@ -170,7 +170,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
GST_DEBUG_OBJECT (e, " norms");
/* norms... */
for (n = 0;; n++) {
struct v4l2_standard standard;
struct v4l2_standard standard = { 0, };
GstV4l2TunerNorm *v4l2norm;
GstTunerNorm *norm;
......@@ -209,7 +209,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
GST_DEBUG_OBJECT (e, " controls+menus");
/* and lastly, controls+menus (if appropriate) */
for (n = V4L2_CID_BASE;; n++) {
struct v4l2_queryctrl control;
struct v4l2_queryctrl control = { 0, };
GstV4l2ColorBalanceChannel *v4l2channel;
GstColorBalanceChannel *channel;
......
......@@ -486,16 +486,18 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src)
/* format enumeration */
for (n = 0;; n++) {
format = g_new (struct v4l2_fmtdesc, 1);
format = g_new0 (struct v4l2_fmtdesc, 1);
format->index = n;
format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {
if (errno == EINVAL)
if (errno == EINVAL) {
g_free (format);
break; /* end of enumeration */
else
} else {
goto failed;
}
}
GST_LOG_OBJECT (v4l2src, "index: %u", format->index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment