diff --git a/ChangeLog b/ChangeLog index e96f3448b3..6ac3645140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-02-28 Sebastian Dröge + + * 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 * tests/benchmarks/Makefile.am: diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index a6970b1648..2af4ad92d8 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -349,7 +349,7 @@ static gboolean gst_fd_sink_start (GstBaseSink * basesink) { GstFdSink *fdsink; - GstPollFD fd; + GstPollFD fd = { 0, }; fdsink = GST_FD_SINK (basesink); 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; gst_poll_remove_fd (fdsink->fdset, &fd); + /* Reset the GstPollFD */ + memset (&fd, 0, sizeof (GstPollFD)); + fd.fd = new_fd; gst_poll_add_fd (fdsink->fdset, &fd); gst_poll_fd_ctl_write (fdsink->fdset, &fd, TRUE); diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 97ada88a82..a415414760 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -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 * gst_fd_src_update_fd() was called earlier */ if (src->fdset != NULL) { - GstPollFD fd; + GstPollFD fd = { 0, }; if (src->fd >= 0) { fd.fd = src->fd; gst_poll_remove_fd (src->fdset, &fd); } + /* Reset the GstPollFD */ + memset (&fd, 0, sizeof (GstPollFD)); + fd.fd = src->new_fd; gst_poll_add_fd (src->fdset, &fd); gst_poll_fd_ctl_read (src->fdset, &fd, TRUE); diff --git a/tests/check/gst/gstpoll.c b/tests/check/gst/gstpoll.c index 00a579f60c..1626b4daf5 100644 --- a/tests/check/gst/gstpoll.c +++ b/tests/check/gst/gstpoll.c @@ -34,8 +34,8 @@ static void test_poll_wait (GstPollMode mode) { GstPoll *set; - GstPollFD rfd; - GstPollFD wfd; + GstPollFD rfd = { 0, }; + GstPollFD wfd = { 0, }; gint socks[2]; guchar c = 'A'; @@ -100,7 +100,9 @@ test_poll_wait (GstPollMode mode) GST_START_TEST (test_poll_basic) { GstPoll *set; - GstPollFD fd = {.fd = 1 }; + GstPollFD fd = { 0, }; + + fd.fd = 1; set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE); fail_if (set == NULL, "Failed to create a GstPoll"); @@ -178,7 +180,9 @@ static gpointer delayed_restart (gpointer data) { GstPoll *set = data; - GstPollFD fd = {.fd = 1 }; + GstPollFD fd = { 0, }; + + fd.fd = 1; THREAD_START (); @@ -194,7 +198,9 @@ delayed_restart (gpointer data) GST_START_TEST (test_poll_wait_restart) { GstPoll *set; - GstPollFD fd = {.fd = 1 }; + GstPollFD fd = { 0, }; + + fd.fd = 1; set = gst_poll_new (GST_POLL_MODE_AUTO, TRUE); fail_if (set == NULL, "Failed to create a GstPoll"); @@ -262,7 +268,9 @@ static gpointer delayed_control (gpointer data) { GstPoll *set = data; - GstPollFD fd = {.fd = 1 }; + GstPollFD fd = { 0, }; + + fd.fd = 1; THREAD_START (); @@ -286,7 +294,9 @@ delayed_control (gpointer data) GST_START_TEST (test_poll_controllable) { GstPoll *set; - GstPollFD fd = {.fd = 1 }; + GstPollFD fd = { 0, }; + + fd.fd = 1; set = gst_poll_new (GST_POLL_MODE_AUTO, FALSE); fail_if (set == NULL, "Failed to create a GstPoll");