summaryrefslogtreecommitdiff
path: root/sys/v4l
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-03-13 15:22:11 (GMT)
committerJan Schmidt <thaytan@noraisin.net>2009-03-13 15:58:33 (GMT)
commit3beecff12594d3ad03377d94d545b05f1ab3c109 (patch)
tree949b1893e1308ae03f562e71303b1eb75db2d9f8 /sys/v4l
parentf4b7cbbf1639776a4c066b04462bed13d22d02ae (diff)
downloadgst-plugins-base-3beecff12594d3ad03377d94d545b05f1ab3c109.tar.gz
gst-plugins-base-3beecff12594d3ad03377d94d545b05f1ab3c109.tar.xz
v4lsrc: Fix some valgrind warnings about leaked memory and uninitialised data.
Diffstat (limited to 'sys/v4l')
-rw-r--r--sys/v4l/v4l_calls.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c
index 0a01265..05613d4 100644
--- a/sys/v4l/v4l_calls.c
+++ b/sys/v4l/v4l_calls.c
@@ -295,7 +295,7 @@ gst_v4l_get_num_chans (GstV4lElement * v4lelement)
GList *
gst_v4l_get_chan_names (GstV4lElement * v4lelement)
{
- struct video_channel vchan;
+ struct video_channel vchan = { 0 };
GList *list = NULL;
gint i;
@@ -305,16 +305,20 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement)
return NULL;
for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) {
- GstV4lTunerChannel *v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL,
- NULL);
- GstTunerChannel *channel = GST_TUNER_CHANNEL (v4lchannel);
+ GstV4lTunerChannel *v4lchannel;
+ GstTunerChannel *channel;
vchan.channel = i;
- if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0)
- return NULL; /* memleak... */
+ if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0) {
+ /* Skip this channel */
+ continue;
+ }
+ v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL, NULL);
+ v4lchannel->index = i;
+
+ channel = GST_TUNER_CHANNEL (v4lchannel);
channel->label = g_strdup (vchan.name);
channel->flags = GST_TUNER_CHANNEL_INPUT;
- v4lchannel->index = i;
if (vchan.flags & VIDEO_VC_TUNER) {
struct video_tuner vtun;
gint n;
@@ -362,10 +366,10 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement)
}
}
}
- list = g_list_append (list, (gpointer) channel);
+ list = g_list_prepend (list, (gpointer) channel);
}
- return list;
+ return g_list_reverse (list);
}