From d666318c7adae3c9a773844a74ec9cec3fba79b8 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Fri, 16 Dec 2011 14:52:20 -0500 Subject: Fix a possible small memory leak --- sshfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sshfs.c') 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; } -- cgit v1.2.3