diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2007-12-11 11:50:54 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2007-12-11 11:50:54 +0000 |
commit | 8d0960ec264312fa2f9cdf1efbc9b0082e9baac7 (patch) | |
tree | 376f7399889a99150868fbe27af1ae52117ae719 /sys/v4l2/v4l2src_calls.c | |
parent | dbf28d28e755089fdb13790ca930f1511c17adc0 (diff) |
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.
Diffstat (limited to 'sys/v4l2/v4l2src_calls.c')
-rw-r--r-- | sys/v4l2/v4l2src_calls.c | 8 |
1 files changed, 5 insertions, 3 deletions
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); |