qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 084/104] Virtiofsd: fix memory leak on fuse queueinfo


From: Dr. David Alan Gilbert (git)
Subject: [PATCH 084/104] Virtiofsd: fix memory leak on fuse queueinfo
Date: Thu, 12 Dec 2019 16:38:44 +0000

From: Liu Bo <address@hidden>

For fuse's queueinfo, both queueinfo array and queueinfos are allocated in
fv_queue_set_started() but not cleaned up when the daemon process quits.

This fixes the leak in proper places.

Signed-off-by: Liu Bo <address@hidden>
Signed-off-by: Eric Ren <address@hidden>
---
 tools/virtiofsd/fuse_virtio.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 7b22ae8d4f..a364f23d5d 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -671,6 +671,8 @@ static void fv_queue_set_started(VuDev *dev, int qidx, bool 
started)
         }
         close(ourqi->kill_fd);
         ourqi->kick_fd = -1;
+        free(vud->qi[qidx]);
+        vud->qi[qidx] = NULL;
     }
 }
 
@@ -878,6 +880,13 @@ int virtio_session_mount(struct fuse_session *se)
 void virtio_session_close(struct fuse_session *se)
 {
     close(se->vu_socketfd);
+
+    if (!se->virtio_dev) {
+        return;
+    }
+
+    close(se->vu_socketfd);
+    free(se->virtio_dev->qi);
     free(se->virtio_dev);
     se->virtio_dev = NULL;
 }
-- 
2.23.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]