aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <ptoscano@redhat.com>2016-10-07 15:50:19 +0200
committerAndreas Schneider <asn@cryptomilk.org>2016-10-22 16:03:33 +0200
commitbc78383fac92069aafb043f645510a939c69b401 (patch)
tree85a2019842da05e79e843ae28421e76861bc9e44
parent1ec528b048c6e078b939def17ec983a753e5ffc3 (diff)
downloadlibssh-bc78383fac92069aafb043f645510a939c69b401.tar.gz
libssh-bc78383fac92069aafb043f645510a939c69b401.tar.xz
libssh-bc78383fac92069aafb043f645510a939c69b401.zip
sftp: Fix memory leak in sftp_fstat
When parsing the result of a successful fstat call, make sure to free the resulting reply message. Signed-off-by: Pino Toscano <ptoscano@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--src/sftp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sftp.c b/src/sftp.c
index f98601ff..3b8e0985 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -3189,7 +3189,10 @@ sftp_attributes sftp_fstat(sftp_file file) {
}
if (msg->packet_type == SSH_FXP_ATTRS){
- return sftp_parse_attr(file->sftp, msg->payload, 0);
+ sftp_attributes attr = sftp_parse_attr(file->sftp, msg->payload, 0);
+ sftp_message_free(msg);
+
+ return attr;
} else if (msg->packet_type == SSH_FXP_STATUS) {
status = parse_status_msg(msg);
sftp_message_free(msg);