From a250bc91a29211e4792f2098769363a820b16823 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 7 Nov 2002 14:46:20 +0000 Subject: Fix memory leak. Patch provided by Frederic Gobry --- mailbox/stream.c | 4 ++++ mailbox/tcp.c | 11 ----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/mailbox/stream.c b/mailbox/stream.c index d88ac462d..13bfcc947 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 17eb2fcaf..87f4f8ba1 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); } -- cgit v1.2.1