Initialize some uninitialized variables as spotted by valgrind.

Original commit message from CVS:
* plugins/elements/gstfdsink.c: (gst_fd_sink_start),
(gst_fd_sink_update_fd):
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd):
* tests/check/gst/gstpoll.c: (test_poll_wait), (GST_START_TEST),
(delayed_restart), (delayed_control):
Initialize some uninitialized variables as spotted by valgrind.
This commit is contained in:
Sebastian Dröge 2008-02-28 19:58:26 +00:00
parent 6e01b07d96
commit 4c31dc7cc4
4 changed files with 34 additions and 9 deletions

View file

@ -1,3 +1,12 @@
2008-02-28 Sebastian Dröge <slomo@circular-chaos.org>
* plugins/elements/gstfdsink.c: (gst_fd_sink_start),
(gst_fd_sink_update_fd):
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd):
* tests/check/gst/gstpoll.c: (test_poll_wait), (GST_START_TEST),
(delayed_restart), (delayed_control):
Initialize some uninitialized variables as spotted by valgrind.
2008-02-28 Wim Taymans <wim.taymans@collabora.co.uk> 2008-02-28 Wim Taymans <wim.taymans@collabora.co.uk>
* tests/benchmarks/Makefile.am: * tests/benchmarks/Makefile.am:

View file

@ -349,7 +349,7 @@ static gboolean
gst_fd_sink_start (GstBaseSink * basesink) gst_fd_sink_start (GstBaseSink * basesink)
{ {
GstFdSink *fdsink; GstFdSink *fdsink;
GstPollFD fd; GstPollFD fd = { 0, };
fdsink = GST_FD_SINK (basesink); fdsink = GST_FD_SINK (basesink);
if (!gst_fd_sink_check_fd (fdsink, fdsink->fd)) if (!gst_fd_sink_check_fd (fdsink, fdsink->fd))
@ -429,6 +429,9 @@ gst_fd_sink_update_fd (GstFdSink * fdsink, int new_fd)
fd.fd = fdsink->fd; fd.fd = fdsink->fd;
gst_poll_remove_fd (fdsink->fdset, &fd); gst_poll_remove_fd (fdsink->fdset, &fd);
/* Reset the GstPollFD */
memset (&fd, 0, sizeof (GstPollFD));
fd.fd = new_fd; fd.fd = new_fd;
gst_poll_add_fd (fdsink->fdset, &fd); gst_poll_add_fd (fdsink->fdset, &fd);
gst_poll_fd_ctl_write (fdsink->fdset, &fd, TRUE); gst_poll_fd_ctl_write (fdsink->fdset, &fd, TRUE);

View file

@ -178,13 +178,16 @@ gst_fd_src_update_fd (GstFdSrc * src)
/* we need to always update the fdset since it may not have existed when /* we need to always update the fdset since it may not have existed when
* gst_fd_src_update_fd() was called earlier */ * gst_fd_src_update_fd() was called earlier */
if (src->fdset != NULL) { if (src->fdset != NULL) {
GstPollFD fd; GstPollFD fd = { 0, };
if (src->fd >= 0) { if (src->fd >= 0) {
fd.fd = src->fd; fd.fd = src->fd;
gst_poll_remove_fd (src->fdset, &fd); gst_poll_remove_fd (src->fdset, &fd);
} }
/* Reset the GstPollFD */
memset (&fd, 0, sizeof (GstPollFD));
fd.fd = src->new_fd; fd.fd = src->new_fd;
gst_poll_add_fd (src->fdset, &fd); gst_poll_add_fd (src->fdset, &fd);
gst_poll_fd_ctl_read (src->fdset, &fd, TRUE); gst_poll_fd_ctl_read (src->fdset, &fd, TRUE);

View file

@ -34,8 +34,8 @@ static void
test_poll_wait (GstPollMode mode) test_poll_wait (GstPollMode mode)
{ {
GstPoll *set; GstPoll *set;
GstPollFD rfd; GstPollFD rfd = { 0, };
GstPollFD wfd; GstPollFD wfd = { 0, };
gint socks[2]; gint socks[2];
guchar c = 'A'; guchar c = 'A';
@ -100,7 +100,9 @@ test_poll_wait (GstPollMode mode)
GST_START_TEST (test_poll_basic) GST_START_TEST (test_poll_basic)
{ {
GstPoll *set; GstPoll *set;
GstPollFD fd = {.fd = 1 }; GstPollFD fd = { 0, };
fd.fd = 1;
set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE); set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE);
fail_if (set == NULL, "Failed to create a GstPoll"); fail_if (set == NULL, "Failed to create a GstPoll");
@ -178,7 +180,9 @@ static gpointer
delayed_restart (gpointer data) delayed_restart (gpointer data)
{ {
GstPoll *set = data; GstPoll *set = data;
GstPollFD fd = {.fd = 1 }; GstPollFD fd = { 0, };
fd.fd = 1;
THREAD_START (); THREAD_START ();
@ -194,7 +198,9 @@ delayed_restart (gpointer data)
GST_START_TEST (test_poll_wait_restart) GST_START_TEST (test_poll_wait_restart)
{ {
GstPoll *set; GstPoll *set;
GstPollFD fd = {.fd = 1 }; GstPollFD fd = { 0, };
fd.fd = 1;
set = gst_poll_new (GST_POLL_MODE_AUTO, TRUE); set = gst_poll_new (GST_POLL_MODE_AUTO, TRUE);
fail_if (set == NULL, "Failed to create a GstPoll"); fail_if (set == NULL, "Failed to create a GstPoll");
@ -262,7 +268,9 @@ static gpointer
delayed_control (gpointer data) delayed_control (gpointer data)
{ {
GstPoll *set = data; GstPoll *set = data;
GstPollFD fd = {.fd = 1 }; GstPollFD fd = { 0, };
fd.fd = 1;
THREAD_START (); THREAD_START ();
@ -286,7 +294,9 @@ delayed_control (gpointer data)
GST_START_TEST (test_poll_controllable) GST_START_TEST (test_poll_controllable)
{ {
GstPoll *set; GstPoll *set;
GstPollFD fd = {.fd = 1 }; GstPollFD fd = { 0, };
fd.fd = 1;
set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE); set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE);
fail_if (set == NULL, "Failed to create a GstPoll"); fail_if (set == NULL, "Failed to create a GstPoll");