diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-03 12:50:17 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-03 12:50:17 +0000 |
commit | b5eb33bb69c9d5331b6f6c1cc922976c36c1d299 (patch) | |
tree | 8b6abb739cd50ac7fbf09eadda6a965a01639816 /libssh/socket.c | |
parent | 2791ce7e01f9e177d3bd4c49ff2400b04ce9a399 (diff) | |
download | libssh-b5eb33bb69c9d5331b6f6c1cc922976c36c1d299.tar.gz libssh-b5eb33bb69c9d5331b6f6c1cc922976c36c1d299.tar.xz libssh-b5eb33bb69c9d5331b6f6c1cc922976c36c1d299.zip |
Improve ssh_socket_free().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@381 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/socket.c')
-rw-r--r-- | libssh/socket.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libssh/socket.c b/libssh/socket.c index 0fe4ad5..d587f49 100644 --- a/libssh/socket.c +++ b/libssh/socket.c @@ -120,10 +120,13 @@ struct socket *ssh_socket_new(SSH_SESSION *session) { * \brief Deletes a socket object */ void ssh_socket_free(struct socket *s){ - ssh_socket_close(s); - buffer_free(s->in_buffer); - buffer_free(s->out_buffer); - free(s); + if (s == NULL) { + return; + } + ssh_socket_close(s); + buffer_free(s->in_buffer); + buffer_free(s->out_buffer); + SAFE_FREE(s); } #ifndef _WIN32 |