mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
v4lsrc: Fix some valgrind warnings about leaked memory and uninitialised data.
This commit is contained in:
parent
f4b7cbbf16
commit
3beecff125
1 changed files with 13 additions and 9 deletions
|
@ -295,7 +295,7 @@ gst_v4l_get_num_chans (GstV4lElement * v4lelement)
|
||||||
GList *
|
GList *
|
||||||
gst_v4l_get_chan_names (GstV4lElement * v4lelement)
|
gst_v4l_get_chan_names (GstV4lElement * v4lelement)
|
||||||
{
|
{
|
||||||
struct video_channel vchan;
|
struct video_channel vchan = { 0 };
|
||||||
GList *list = NULL;
|
GList *list = NULL;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
@ -305,16 +305,20 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) {
|
for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) {
|
||||||
GstV4lTunerChannel *v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL,
|
GstV4lTunerChannel *v4lchannel;
|
||||||
NULL);
|
GstTunerChannel *channel;
|
||||||
GstTunerChannel *channel = GST_TUNER_CHANNEL (v4lchannel);
|
|
||||||
|
|
||||||
vchan.channel = i;
|
vchan.channel = i;
|
||||||
if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0)
|
if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0) {
|
||||||
return NULL; /* memleak... */
|
/* 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->label = g_strdup (vchan.name);
|
||||||
channel->flags = GST_TUNER_CHANNEL_INPUT;
|
channel->flags = GST_TUNER_CHANNEL_INPUT;
|
||||||
v4lchannel->index = i;
|
|
||||||
if (vchan.flags & VIDEO_VC_TUNER) {
|
if (vchan.flags & VIDEO_VC_TUNER) {
|
||||||
struct video_tuner vtun;
|
struct video_tuner vtun;
|
||||||
gint n;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue