summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLi Qiang <liqiang6-s@360.cn>2016-10-17 14:13:58 +0200
committerGreg Kurz <groug@kaod.org>2016-10-17 14:13:58 +0200
commit4c1586787ff43c9acd18a56c12d720e3e6be9f7c (patch)
tree74f1281bfd92e7555a1b3f913262dc9de6a55184
parentff55e94d23ae94c8628b0115320157c763eb3e06 (diff)
downloadfocaccia-qemu-4c1586787ff43c9acd18a56c12d720e3e6be9f7c.tar.gz
focaccia-qemu-4c1586787ff43c9acd18a56c12d720e3e6be9f7c.zip
9pfs: fix memory leak in v9fs_link
The v9fs_link() function keeps a reference on the source fid object. This
causes a memory leak since the reference never goes down to 0. This patch
fixes the issue.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Greg Kurz <groug@kaod.org>
[groug, rephrased the changelog]
Signed-off-by: Greg Kurz <groug@kaod.org>
-rw-r--r--hw/9pfs/9p.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 66135cf121..d43a552234 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2413,6 +2413,7 @@ static void coroutine_fn v9fs_link(void *opaque)
     if (!err) {
         err = offset;
     }
+    put_fid(pdu, oldfidp);
 out:
     put_fid(pdu, dfidp);
 out_nofid: