From 740b0b700a6338a1cf60c26229651ac5f6724944 Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Tue, 25 Jun 2019 05:53:47 +0800 Subject: Virtiofsd: fix memory leak on fuse queueinfo 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 Signed-off-by: Eric Ren Reviewed-by: Misono Tomohiro Signed-off-by: Dr. David Alan Gilbert --- tools/virtiofsd/fuse_virtio.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/virtiofsd/fuse_virtio.c') diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index b7948def27..fb8d6d1379 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -625,6 +625,8 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx) } close(ourqi->kill_fd); ourqi->kick_fd = -1; + free(vud->qi[qidx]); + vud->qi[qidx] = NULL; } /* Callback from libvhost-user on start or stop of a queue */ @@ -884,6 +886,12 @@ 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; + } + + free(se->virtio_dev->qi); free(se->virtio_dev); se->virtio_dev = NULL; } -- cgit v1.2.3