Commit a250bc91 a250bc91a29211e4792f2098769363a820b16823 by Sergey Poznyakoff

Fix memory leak. Patch provided by Frederic Gobry <frederic.gobry@smartdata.ch>

1 parent f6b7a4d2
......@@ -76,6 +76,10 @@ stream_destroy (stream_t *pstream, void *owner)
stream_close(stream);
if (stream->rbuffer.base)
free (stream->rbuffer.base);
if (stream->_destroy)
stream->_destroy (stream);
free (stream);
}
*pstream = NULL;
......
......@@ -84,15 +84,6 @@ _tcp_open (stream_t stream)
stream_get_flags(stream, &flags);
if (tcp->state == TCP_STATE_INIT)
{
tcp->port = port;
/* FIXME: this seems very strange, it is: tcp->host = strdup(tcp->host)
is this really intended? */
if ((tcp->host = strdup (host)) == NULL)
return ENOMEM;
}
switch (tcp->state)
{
case TCP_STATE_INIT:
......@@ -221,8 +212,6 @@ _tcp_destroy (stream_t stream)
if (tcp->fd != -1)
close (tcp->fd);
if(tcp->host)
free (tcp->host);
free (tcp);
}
......