9pfs: fix memory leak in v9fs_write
PATCH v2 1/1 9pfs: fix memory leak in v9fs_write
From: Li Qiang <[email protected]>
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 <[email protected]>
--- hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p.c +1 -1
@@ -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);
Signature · 1 line
1.8.3.1
Quoted 8 lines · On Wed, 12 Oct 2016 06:10:56 -0700 Li Qiang <[email protected]> wrote:
From: Li Qiang <[email protected]>
If an error occurs when marshal the transfer length to the guest, the
v9fs_writedoesn't free an IO vector, thus leading a memory leak. This patch fix this.Signed-off-by Li Qiang <[email protected]>---
Good catch again!
Reviewed-by Greg Kurz <[email protected]>
Quoted 16 lines
hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/9pfs/9p.c +1
-1@@ -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);