Message ID | 57fe3666.018b240a.e96e4.4825@mx.google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 12 Oct 2016 06:10:56 -0700 Li Qiang <liq3ea@gmail.com> wrote: > From: Li Qiang <liqiang6-s@360.cn> > > If an error occurs when marshal the transfer length to the guest, the > v9fs_write doesn't free an IO vector, thus leading a memory leak. > This patch fix this. > > Signed-off-by: Li Qiang <liqiang6-s@360.cn> > --- Good catch again! Reviewed-by: Greg Kurz <groug@kaod.org> > hw/9pfs/9p.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c > index 8b50bfb..c8cf8c2 100644 > --- a/hw/9pfs/9p.c > +++ b/hw/9pfs/9p.c > @@ -2090,7 +2090,7 @@ static void v9fs_write(void *opaque) > offset = 7; > err = pdu_marshal(pdu, offset, "d", total); > if (err < 0) { > - goto out; > + goto out_qiov; > } > err += offset; > trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 8b50bfb..c8cf8c2 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2090,7 +2090,7 @@ static void v9fs_write(void *opaque) offset = 7; err = pdu_marshal(pdu, offset, "d", total); if (err < 0) { - goto out; + goto out_qiov; } err += offset; trace_v9fs_write_return(pdu->tag, pdu->id, total, err);