sshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ)

This commit is contained in:
cinap_lenrek 2019-10-07 12:51:21 +02:00
parent f763dc1640
commit 6716e9ba20

View file

@ -569,7 +569,7 @@ dir2attrib(Dir *d, uchar **rp)
int uid, gid; int uid, gid;
werrstr("phase error"); werrstr("phase error");
r = emalloc9p(MAXATTRIB); *rp = r = emalloc9p(MAXATTRIB);
e = r + MAXATTRIB; e = r + MAXATTRIB;
fl = 0; fl = 0;
p = r + 4; 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; rc = pack(p, e - p, "uu", d->atime, d->mtime); if(rc < 0) return -1; p += rc;
} }
PUT4(r, fl); PUT4(r, fl);
*rp = r;
return p - r; return p - r;
} }
@ -929,6 +928,7 @@ sendproc(void *)
if(x < 0){ if(x < 0){
responderror(r->req); responderror(r->req);
putsreq(r); putsreq(r);
free(s);
break; break;
} }
rlock(sf); rlock(sf);