[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 079/104] virtiofsd: fix memory leak on lo.source
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PATCH 079/104] virtiofsd: fix memory leak on lo.source |
Date: |
Thu, 12 Dec 2019 16:38:39 +0000 |
From: Liu Bo <address@hidden>
valgrind reported that lo.source is leaked on quiting, but it was defined
as (const char*) as it may point to a const string "/".
Signed-off-by: Liu Bo <address@hidden>
---
tools/virtiofsd/passthrough_ll.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 33092de65a..45cf466178 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -2529,9 +2529,8 @@ int main(int argc, char *argv[])
fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
exit(1);
}
-
} else {
- lo.source = "/";
+ lo.source = strdup("/");
}
lo.root.is_symlink = false;
if (!lo.timeout_set) {
@@ -2610,5 +2609,7 @@ err_out1:
close(lo.root.fd);
}
+ free((char *)lo.source);
+
return ret ? 1 : 0;
}
--
2.23.0
- [PATCH 069/104] virtiofsd: rename unref_inode() to unref_inode_lolocked(), (continued)
- [PATCH 069/104] virtiofsd: rename unref_inode() to unref_inode_lolocked(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 070/104] virtiofsd: fail when parent inode isn't known in lo_do_lookup(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 072/104] virtiofsd: passthrough_ll: fix refcounting on remove/rename, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 071/104] virtiofsd: extract root inode init into setup_root(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 073/104] virtiofsd: passthrough_ll: clean up cache related options, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 074/104] virtiofsd: passthrough_ll: use hashtable, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 075/104] virtiofsd: Clean up inodes on destroy, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 076/104] virtiofsd: support nanosecond resolution for file timestamp, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 077/104] virtiofsd: fix error handling in main(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 078/104] virtiofsd: cleanup allocated resource in se, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 079/104] virtiofsd: fix memory leak on lo.source,
Dr. David Alan Gilbert (git) <=
- [PATCH 080/104] virtiofsd: add helper for lo_data cleanup, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 081/104] virtiofsd: Prevent multiply running with same vhost_user_socket, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 082/104] virtiofsd: enable PARALLEL_DIROPS during INIT, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 084/104] Virtiofsd: fix memory leak on fuse queueinfo, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 083/104] virtiofsd: fix incorrect error handling in lo_do_lookup, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 086/104] virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 085/104] virtiofsd: Support remote posix locks, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 087/104] virtiofsd: prevent fv_queue_thread() vs virtio_loop() races, Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 089/104] virtiofsd: prevent races with lo_dirp_put(), Dr. David Alan Gilbert (git), 2019/12/12
- [PATCH 088/104] virtiofsd: make lo_release() atomic, Dr. David Alan Gilbert (git), 2019/12/12