[lxc-devel] [PATCH] lxc_monitor: fix memory leak. free @fds on ret 1

Arjun Sreedharan arjun024 at gmail.com
Fri Jun 5 10:33:00 UTC 2015


Signed-off-by: Arjun Sreedharan <arjun024 at gmail.com>
---
 src/lxc/lxc_monitor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index b3d8912..39764b8 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -148,6 +148,7 @@ int main(int argc, char *argv[])
 		fd = lxc_monitor_open(my_args.lxcpath[i]);
 		if (fd < 0) {
 			regfree(&preg);
+			free(fds);
 			return 1;
 		}
 		fds[i].fd = fd;
@@ -160,6 +161,7 @@ int main(int argc, char *argv[])
 	for (;;) {
 		if (lxc_monitor_read_fdset(fds, nfds, &msg, -1) < 0) {
 			regfree(&preg);
+			free(fds);
 			return 1;
 		}
 
-- 
1.7.11.7



More information about the lxc-devel mailing list