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:
parent
d45affbd26
commit
761b17e400
@ -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>
|
2004-09-13 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),
|
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),
|
||||||
|
@ -443,7 +443,7 @@ gst_fdset_wait (GstFDSet * set, int timeout)
|
|||||||
case GST_FDSET_MODE_SELECT:
|
case GST_FDSET_MODE_SELECT:
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
struct timeval *tvptr = NULL;
|
struct timeval *tvptr;
|
||||||
|
|
||||||
set->testreadfds = set->readfds;
|
set->testreadfds = set->readfds;
|
||||||
set->testwritefds = set->writefds;
|
set->testwritefds = set->writefds;
|
||||||
@ -453,6 +453,8 @@ gst_fdset_wait (GstFDSet * set, int timeout)
|
|||||||
tv.tv_usec = timeout % 1000;
|
tv.tv_usec = timeout % 1000;
|
||||||
|
|
||||||
tvptr = &tv;
|
tvptr = &tv;
|
||||||
|
} else {
|
||||||
|
tvptr = NULL;
|
||||||
}
|
}
|
||||||
res =
|
res =
|
||||||
select (FD_SETSIZE, &set->testreadfds, &set->testwritefds,
|
select (FD_SETSIZE, &set->testreadfds, &set->testwritefds,
|
||||||
|
@ -1435,26 +1435,28 @@ gst_multifdsink_close (GstMultiFdSink * this)
|
|||||||
this->running = FALSE;
|
this->running = FALSE;
|
||||||
|
|
||||||
SEND_COMMAND (this, CONTROL_STOP);
|
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 (READ_SOCKET (this).fd);
|
||||||
close (WRITE_SOCKET (this).fd);
|
close (WRITE_SOCKET (this).fd);
|
||||||
gst_fdset_remove_fd (this->fdset, &READ_SOCKET (this));
|
|
||||||
|
|
||||||
if (this->streamheader) {
|
if (this->streamheader) {
|
||||||
GSList *l;
|
g_slist_foreach (this->streamheader, (GFunc) gst_data_unref, NULL);
|
||||||
|
|
||||||
for (l = this->streamheader; l; l = l->next) {
|
|
||||||
gst_buffer_unref (l->data);
|
|
||||||
}
|
|
||||||
g_slist_free (this->streamheader);
|
g_slist_free (this->streamheader);
|
||||||
|
this->streamheader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclass->close)
|
if (fclass->close)
|
||||||
fclass->close (this);
|
fclass->close (this);
|
||||||
|
|
||||||
gst_fdset_free (this->fdset);
|
if (this->fdset) {
|
||||||
this->fdset = NULL;
|
gst_fdset_remove_fd (this->fdset, &READ_SOCKET (this));
|
||||||
|
gst_fdset_free (this->fdset);
|
||||||
|
this->fdset = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn
|
||||||
|
@ -304,8 +304,6 @@ gst_tcpserversink_init_send (GstMultiFdSink * parent)
|
|||||||
gst_fdset_add_fd (parent->fdset, &this->server_sock);
|
gst_fdset_add_fd (parent->fdset, &this->server_sock);
|
||||||
gst_fdset_fd_ctl_read (parent->fdset, &this->server_sock, TRUE);
|
gst_fdset_fd_ctl_read (parent->fdset, &this->server_sock, TRUE);
|
||||||
|
|
||||||
//FD_SET (this->server_sock_fd, &parent->readfds);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,10 +313,10 @@ gst_tcpserversink_close (GstMultiFdSink * parent)
|
|||||||
GstTCPServerSink *this = GST_TCPSERVERSINK (parent);
|
GstTCPServerSink *this = GST_TCPSERVERSINK (parent);
|
||||||
|
|
||||||
if (this->server_sock.fd != -1) {
|
if (this->server_sock.fd != -1) {
|
||||||
|
gst_fdset_remove_fd (parent->fdset, &this->server_sock);
|
||||||
|
|
||||||
close (this->server_sock.fd);
|
close (this->server_sock.fd);
|
||||||
this->server_sock.fd = -1;
|
this->server_sock.fd = -1;
|
||||||
|
|
||||||
gst_fdset_remove_fd (parent->fdset, &this->server_sock);
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user