From 6716e9ba20e378efe32924813c531943373afc46 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 7 Oct 2019 12:51:21 +0200 Subject: [PATCH] sshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ) --- sys/src/cmd/sshfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/src/cmd/sshfs.c b/sys/src/cmd/sshfs.c index b6e7a93da..30638ddb6 100644 --- a/sys/src/cmd/sshfs.c +++ b/sys/src/cmd/sshfs.c @@ -569,7 +569,7 @@ dir2attrib(Dir *d, uchar **rp) int uid, gid; werrstr("phase error"); - r = emalloc9p(MAXATTRIB); + *rp = r = emalloc9p(MAXATTRIB); e = r + MAXATTRIB; fl = 0; p = r + 4; @@ -604,7 +604,6 @@ dir2attrib(Dir *d, uchar **rp) rc = pack(p, e - p, "uu", d->atime, d->mtime); if(rc < 0) return -1; p += rc; } PUT4(r, fl); - *rp = r; return p - r; } @@ -929,6 +928,7 @@ sendproc(void *) if(x < 0){ responderror(r->req); putsreq(r); + free(s); break; } rlock(sf);