aboutsummaryrefslogtreecommitdiff
path: root/libssh/sftpserver.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-27 11:33:37 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-27 11:33:37 +0000
commit5d231425998aca6af38045cd94a09986d79adb5d (patch)
treed0a1f314f131bbb3c9364a8088b2967510c6f352 /libssh/sftpserver.c
parent1f6341f5497f38244ff92be451310e8c061cda39 (diff)
downloadlibssh-5d231425998aca6af38045cd94a09986d79adb5d.tar.gz
libssh-5d231425998aca6af38045cd94a09986d79adb5d.tar.xz
libssh-5d231425998aca6af38045cd94a09986d79adb5d.zip
Improve sftp_client_message_free.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@621 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/sftpserver.c')
-rw-r--r--libssh/sftpserver.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libssh/sftpserver.c b/libssh/sftpserver.c
index 2fe415bb..51c21176 100644
--- a/libssh/sftpserver.c
+++ b/libssh/sftpserver.c
@@ -211,16 +211,17 @@ SFTP_CLIENT_MESSAGE *sftp_get_client_message(SFTP_SESSION *sftp) {
}
void sftp_client_message_free(SFTP_CLIENT_MESSAGE *msg) {
- if(msg->filename)
- free(msg->filename);
- if(msg->data)
- free(msg->data);
- if(msg->attr)
- sftp_attributes_free(msg->attr);
- if(msg->handle)
- free(msg->handle);
- memset(msg,'X',sizeof(*msg));
- free(msg);
+ if (msg == NULL) {
+ return;
+ }
+
+ SAFE_FREE(msg->filename);
+ string_free(msg->data);
+ string_free(msg->handle);
+ sftp_attributes_free(msg->attr);
+
+ ZERO_STRUCTP(msg);
+ SAFE_FREE(msg);
}
int sftp_reply_name(SFTP_CLIENT_MESSAGE *msg, char *name, SFTP_ATTRIBUTES *attr){