[lxc-devel] [lxc/master] attach: fix double free

2xsec on Github lxc-bot at linuxcontainers.org
Tue Jun 12 09:19:58 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1717 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180612/03a39213/attachment.bin>
-------------- next part --------------
From d35b372aaf5da0a490154c8517fd41b565c4669c Mon Sep 17 00:00:00 2001
From: Donghwa Jeong <dh48.jeong at samsung.com>
Date: Tue, 12 Jun 2018 18:16:35 +0900
Subject: [PATCH] attach: fix double free

Signed-off-by: Donghwa Jeong <dh48.jeong at samsung.com>
---
 src/lxc/attach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index b62dcecfa..9bbdd0e6a 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -172,7 +172,6 @@ static void lxc_proc_put_context_info(struct lxc_proc_context_info *ctx)
 
 	lxc_proc_close_ns_fd(ctx);
 	free(ctx);
-	ctx = NULL;
 }
 
 /**
@@ -908,6 +907,7 @@ static int attach_child_main(struct attach_clone_payload *payload)
 	close(payload->ipc_socket);
 	payload->ipc_socket = -EBADF;
 	lxc_proc_put_context_info(init_ctx);
+	payload->init_ctx = NULL;
 
 	/* The following is done after the communication socket is shut down.
 	 * That way, all errors that might (though unlikely) occur up until this


More information about the lxc-devel mailing list