diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-29 11:55:43 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-29 11:55:43 +0000 |
commit | 78ad279a43a27a4a780ebefde3a4bfbde0091535 (patch) | |
tree | 40cb1c18dde4e306961e226158d4b76c9bcddc27 /libssh | |
parent | e13c2871ffa050f8b0d5f417da796391bfd10f17 (diff) | |
download | libssh-78ad279a43a27a4a780ebefde3a4bfbde0091535.tar.gz libssh-78ad279a43a27a4a780ebefde3a4bfbde0091535.tar.xz libssh-78ad279a43a27a4a780ebefde3a4bfbde0091535.zip |
Improve ssh_bind_free().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@653 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/server.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libssh/server.c b/libssh/server.c index b534a90..349e910 100644 --- a/libssh/server.c +++ b/libssh/server.c @@ -252,12 +252,18 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind) { } void ssh_bind_free(SSH_BIND *ssh_bind){ - if(ssh_bind->bindfd>=0) - close(ssh_bind->bindfd); - ssh_bind->bindfd=-1; - if(ssh_bind->options) - ssh_options_free(ssh_bind->options); - free(ssh_bind); + if (ssh_bind == NULL) { + return; + } + + if (ssh_bind->bindfd >= 0) { + close(ssh_bind->bindfd); + } + ssh_bind->bindfd = -1; + if (ssh_bind->options) { + ssh_options_free(ssh_bind->options); + } + SAFE_FREE(ssh_bind); } extern char *supported_methods[]; |