gst/tcp/: Be a bit more paranoid when freeing memory.

Original commit message from CVS:
* gst/tcp/gstfdset.c: (gst_fdset_wait):
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_close):
* gst/tcp/gsttcpserversink.c: (gst_tcpserversink_init_send),
(gst_tcpserversink_close):
Be a bit more paranoid when freeing memory.
This commit is contained in:
Wim Taymans 2004-09-14 14:03:16 +00:00
parent d45affbd26
commit 761b17e400
4 changed files with 24 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2004-09-17 Wim Taymans <wim@fluendo.com>
* gst/tcp/gstfdset.c: (gst_fdset_wait):
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_close):
* gst/tcp/gsttcpserversink.c: (gst_tcpserversink_init_send),
(gst_tcpserversink_close):
Be a bit more paranoid when freeing memory.
2004-09-13 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),

View file

@ -443,7 +443,7 @@ gst_fdset_wait (GstFDSet * set, int timeout)
case GST_FDSET_MODE_SELECT:
{
struct timeval tv;
struct timeval *tvptr = NULL;
struct timeval *tvptr;
set->testreadfds = set->readfds;
set->testwritefds = set->writefds;
@ -453,6 +453,8 @@ gst_fdset_wait (GstFDSet * set, int timeout)
tv.tv_usec = timeout % 1000;
tvptr = &tv;
} else {
tvptr = NULL;
}
res =
select (FD_SETSIZE, &set->testreadfds, &set->testwritefds,

View file

@ -1435,26 +1435,28 @@ gst_multifdsink_close (GstMultiFdSink * this)
this->running = FALSE;
SEND_COMMAND (this, CONTROL_STOP);
g_thread_join (this->thread);
if (this->thread) {
g_thread_join (this->thread);
this->thread = NULL;
}
close (READ_SOCKET (this).fd);
close (WRITE_SOCKET (this).fd);
gst_fdset_remove_fd (this->fdset, &READ_SOCKET (this));
if (this->streamheader) {
GSList *l;
for (l = this->streamheader; l; l = l->next) {
gst_buffer_unref (l->data);
}
g_slist_foreach (this->streamheader, (GFunc) gst_data_unref, NULL);
g_slist_free (this->streamheader);
this->streamheader = NULL;
}
if (fclass->close)
fclass->close (this);
gst_fdset_free (this->fdset);
this->fdset = NULL;
if (this->fdset) {
gst_fdset_remove_fd (this->fdset, &READ_SOCKET (this));
gst_fdset_free (this->fdset);
this->fdset = NULL;
}
}
static GstElementStateReturn

View file

@ -304,8 +304,6 @@ gst_tcpserversink_init_send (GstMultiFdSink * parent)
gst_fdset_add_fd (parent->fdset, &this->server_sock);
gst_fdset_fd_ctl_read (parent->fdset, &this->server_sock, TRUE);
//FD_SET (this->server_sock_fd, &parent->readfds);
return TRUE;
}
@ -315,10 +313,10 @@ gst_tcpserversink_close (GstMultiFdSink * parent)
GstTCPServerSink *this = GST_TCPSERVERSINK (parent);
if (this->server_sock.fd != -1) {
gst_fdset_remove_fd (parent->fdset, &this->server_sock);
close (this->server_sock.fd);
this->server_sock.fd = -1;
gst_fdset_remove_fd (parent->fdset, &this->server_sock);
}
return TRUE;
}