aboutsummaryrefslogtreecommitdiff
path: root/libssh/sftp.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-23 12:23:38 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-23 12:23:38 +0000
commitbaee8c17b5ef1e09c5cf1f76ab610b0aa87b9451 (patch)
tree5f58f114c868ecab773c7eca9e2ecc62646fdd28 /libssh/sftp.c
parent441929f8b8583b8b5e2dbb2228bfc8bd556fb24e (diff)
downloadlibssh-baee8c17b5ef1e09c5cf1f76ab610b0aa87b9451.tar.gz
libssh-baee8c17b5ef1e09c5cf1f76ab610b0aa87b9451.tar.xz
libssh-baee8c17b5ef1e09c5cf1f76ab610b0aa87b9451.zip
Improve sftp_attributes_free().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@597 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/sftp.c')
-rw-r--r--libssh/sftp.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/libssh/sftp.c b/libssh/sftp.c
index b3c2f79f..30723061 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -1238,21 +1238,20 @@ int sftp_dir_eof(SFTP_DIR *dir) {
/* Free a SFTP_ATTRIBUTE handle */
void sftp_attributes_free(SFTP_ATTRIBUTES *file){
- if(file->name)
- free(file->name);
- if(file->longname)
- free(file->longname);
- if(file->acl)
- free(file->acl);
- if(file->extended_data)
- free(file->extended_data);
- if(file->extended_type)
- free(file->extended_type);
- if(file->group)
- free(file->group);
- if(file->owner)
- free(file->owner);
- free(file);
+ if (file == NULL) {
+ return;
+ }
+
+ string_free(file->acl);
+ string_free(file->extended_data);
+ string_free(file->extended_type);
+
+ SAFE_FREE(file->name);
+ SAFE_FREE(file->longname);
+ SAFE_FREE(file->group);
+ SAFE_FREE(file->owner);
+
+ SAFE_FREE(file);
}
static int sftp_handle_close(SFTP_SESSION *sftp, STRING *handle){