summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-07 14:46:20 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2002-11-07 14:46:20 (GMT)
commita250bc91a29211e4792f2098769363a820b16823 (patch) (side-by-side diff)
tree21d1a270cb5426a36faabb1b1a5ddd0bd789ed6a
parentf6b7a4d2cbf509170cb3dc93091bcb108e69e3cc (diff)
downloadmailutils-a250bc91a29211e4792f2098769363a820b16823.tar.gz
mailutils-a250bc91a29211e4792f2098769363a820b16823.tar.bz2
Fix memory leak. Patch provided by Frederic Gobry <frederic.gobry@smartdata.ch>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--mailbox/stream.c4
-rw-r--r--mailbox/tcp.c11
2 files changed, 4 insertions, 11 deletions
diff --git a/mailbox/stream.c b/mailbox/stream.c
index d88ac46..13bfcc9 100644
--- a/mailbox/stream.c
+++ b/mailbox/stream.c
@@ -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;
diff --git a/mailbox/tcp.c b/mailbox/tcp.c
index 17eb2fc..87f4f8b 100644
--- a/mailbox/tcp.c
+++ b/mailbox/tcp.c
@@ -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);
}

Return to:

Send suggestions and report system problems to the System administrator.