[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
channel_accept memory leak
[Thread Prev] | [Thread Next]
- Subject: channel_accept memory leak
- From: Vic Lee <llyzs@xxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 01 Feb 2010 23:29:37 +0800
- To: libssh <libssh@xxxxxxxxxx>
Hi, Found another small memory leak. The patch should self-explain as it's quite obvious. It was found in v0-4 branch, and I think it's likely also be in master. Thanks, Vic
From c49e89801cc42fcde22ba21d704657e55f966dbb Mon Sep 17 00:00:00 2001
From: Vic Lee <llyzs@xxxxxxx>
Date: Mon, 1 Feb 2010 23:26:10 +0800
Subject: [PATCH] The ssh_message object needs to be freed after processing in channel_accept().
Signed-off-by: Vic Lee <llyzs@xxxxxxx>
---
libssh/channels.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/libssh/channels.c b/libssh/channels.c
index 13ea25f..a046e89 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -1359,6 +1359,7 @@ static ssh_channel channel_accept(ssh_session session, int channeltype,
};
#endif
ssh_message msg = NULL;
+ ssh_channel channel = NULL;
struct ssh_iterator *iterator;
int t;
@@ -1373,7 +1374,9 @@ static ssh_channel channel_accept(ssh_session session, int channeltype,
if (ssh_message_type(msg) == SSH_REQUEST_CHANNEL_OPEN &&
ssh_message_subtype(msg) == channeltype) {
ssh_list_remove(session->ssh_message_list, iterator);
- return ssh_message_channel_request_open_reply_accept(msg);
+ channel = ssh_message_channel_request_open_reply_accept(msg);
+ ssh_message_free(msg);
+ return channel;
}
iterator = iterator->next;
}
--
1.6.5
Archive administrator: postmaster@lists.cynapses.org