[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] virtfs-proxy-helper: Fix a resource leak in main()
From: |
Alex Chen |
Subject: |
[PATCH] virtfs-proxy-helper: Fix a resource leak in main() |
Date: |
Thu, 26 Nov 2020 10:16:24 +0000 |
Only one of the options -s and -f can be used. When -f is used,
the fd is created externally and does not need to be closed.
When -s is used, a new socket fd is created, and this socket fd
needs to be closed at the end of main().
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
fsdev/virtfs-proxy-helper.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 15c0e79b06..339d477169 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -1154,6 +1154,9 @@ int main(int argc, char **argv)
process_requests(sock);
error:
g_free(rpath);
+ if (sock_name) {
+ close(sock);
+ }
g_free(sock_name);
do_log(LOG_INFO, "Done\n");
closelog();
--
2.19.1
- [PATCH] virtfs-proxy-helper: Fix a resource leak in main(),
Alex Chen <=