1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-03 22:13:11 +03:00

When shutting down sub-systems and closing the channel try our best

to free any memory still allocated in the state variables
This commit is contained in:
James Housley
2007-06-07 16:43:20 +00:00
parent bb32d080fa
commit b2f3582a59
5 changed files with 125 additions and 0 deletions

View File

@@ -864,6 +864,22 @@ LIBSSH2_API void libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey)
{
LIBSSH2_SESSION *session = pkey->channel->session;
/*
* Make sure all memory used in the state variables are free
*/
if (pkey->receive_packet) {
LIBSSH2_FREE(session, pkey->receive_packet);
}
if (pkey->add_packet) {
LIBSSH2_FREE(session, pkey->add_packet);
}
if (pkey->remove_packet) {
LIBSSH2_FREE(session, pkey->remove_packet);
}
if (pkey->listFetch_data) {
LIBSSH2_FREE(session, pkey->listFetch_data);
}
libssh2_channel_free(pkey->channel);
LIBSSH2_FREE(session, pkey);
}