aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kelly <mike@pair.com>2011-12-16 14:52:20 -0500
committerMiklos Szeredi <mszeredi@suse.cz>2011-12-20 15:33:58 +0100
commitd666318c7adae3c9a773844a74ec9cec3fba79b8 (patch)
treebe2625b57dd72b777277a5a354c758cb653d3f2d
parentea0d68651e0f1822f9e4bb3bd9fecb642078d01a (diff)
downloadsshfs-d666318c7adae3c9a773844a74ec9cec3fba79b8.tar
sshfs-d666318c7adae3c9a773844a74ec9cec3fba79b8.tar.gz
sshfs-d666318c7adae3c9a773844a74ec9cec3fba79b8.tar.bz2
sshfs-d666318c7adae3c9a773844a74ec9cec3fba79b8.zip
Fix a possible small memory leak
-rw-r--r--sshfs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sshfs.c b/sshfs.c
index c5a2434..d0517ff 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -1382,16 +1382,20 @@ static int sftp_init_reply_ok(struct buffer *buf, uint32_t *version)
struct buffer buf2;
buf_init(&buf2, len - 5);
- if (do_read(&buf2) == -1)
+ if (do_read(&buf2) == -1) {
+ buf_free(&buf2);
return -1;
+ }
do {
char *ext;
char *extdata;
if (buf_get_string(&buf2, &ext) == -1 ||
- buf_get_string(&buf2, &extdata) == -1)
+ buf_get_string(&buf2, &extdata) == -1) {
+ buf_free(&buf2);
return -1;
+ }
DEBUG("Extension: %s <%s>\n", ext, extdata);
@@ -1407,6 +1411,7 @@ static int sftp_init_reply_ok(struct buffer *buf, uint32_t *version)
strcmp(extdata, "1") == 0)
sshfs.ext_hardlink = 1;
} while (buf2.len < buf2.size);
+ buf_free(&buf2);
}
return 0;
}