mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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.
This commit is contained in:
parent
dbf28d28e7
commit
8d0960ec26
3 changed files with 15 additions and 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>
|
2007-12-11 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
Patch by: Wouter Cloetens <wouter at mind dot be>
|
Patch by: Wouter Cloetens <wouter at mind dot be>
|
||||||
|
|
|
@ -102,7 +102,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
||||||
GST_DEBUG_OBJECT (e, " channels");
|
GST_DEBUG_OBJECT (e, " channels");
|
||||||
/* and now, the channels */
|
/* and now, the channels */
|
||||||
for (n = 0;; n++) {
|
for (n = 0;; n++) {
|
||||||
struct v4l2_input input;
|
struct v4l2_input input = { 0, };
|
||||||
GstV4l2TunerChannel *v4l2channel;
|
GstV4l2TunerChannel *v4l2channel;
|
||||||
GstTunerChannel *channel;
|
GstTunerChannel *channel;
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
||||||
GST_DEBUG_OBJECT (e, " norms");
|
GST_DEBUG_OBJECT (e, " norms");
|
||||||
/* norms... */
|
/* norms... */
|
||||||
for (n = 0;; n++) {
|
for (n = 0;; n++) {
|
||||||
struct v4l2_standard standard;
|
struct v4l2_standard standard = { 0, };
|
||||||
GstV4l2TunerNorm *v4l2norm;
|
GstV4l2TunerNorm *v4l2norm;
|
||||||
GstTunerNorm *norm;
|
GstTunerNorm *norm;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
|
||||||
GST_DEBUG_OBJECT (e, " controls+menus");
|
GST_DEBUG_OBJECT (e, " controls+menus");
|
||||||
/* and lastly, controls+menus (if appropriate) */
|
/* and lastly, controls+menus (if appropriate) */
|
||||||
for (n = V4L2_CID_BASE;; n++) {
|
for (n = V4L2_CID_BASE;; n++) {
|
||||||
struct v4l2_queryctrl control;
|
struct v4l2_queryctrl control = { 0, };
|
||||||
GstV4l2ColorBalanceChannel *v4l2channel;
|
GstV4l2ColorBalanceChannel *v4l2channel;
|
||||||
GstColorBalanceChannel *channel;
|
GstColorBalanceChannel *channel;
|
||||||
|
|
||||||
|
|
|
@ -486,16 +486,18 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src)
|
||||||
|
|
||||||
/* format enumeration */
|
/* format enumeration */
|
||||||
for (n = 0;; n++) {
|
for (n = 0;; n++) {
|
||||||
format = g_new (struct v4l2_fmtdesc, 1);
|
format = g_new0 (struct v4l2_fmtdesc, 1);
|
||||||
|
|
||||||
format->index = n;
|
format->index = n;
|
||||||
format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
|
|
||||||
if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {
|
if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL) {
|
||||||
|
g_free (format);
|
||||||
break; /* end of enumeration */
|
break; /* end of enumeration */
|
||||||
else
|
} else {
|
||||||
goto failed;
|
goto failed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (v4l2src, "index: %u", format->index);
|
GST_LOG_OBJECT (v4l2src, "index: %u", format->index);
|
||||||
|
|
Loading…
Reference in a new issue