diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | sys/v4l2/v4l2_calls.c | 6 | ||||
-rw-r--r-- | sys/v4l2/v4l2src_calls.c | 8 |
3 files changed, 15 insertions, 6 deletions
@@ -1,3 +1,10 @@ +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> diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index 6233d010..1d005913 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -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; diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index e2a07ea9..dc6a23b2 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -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); |