[CRIU] [PATCH] namespaces: zero struct ns_id when allocating

Tycho Andersen tycho.andersen at canonical.com
Tue Mar 22 19:57:27 PDT 2016


Later (find_ext_ns_id, but probably others as well) we depend on the struct
being zeroed in order to figure out whether or not to collect info about
it. Let's make sure it is actually zeroed.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/namespaces.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index d7f8a9f..724203e 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -259,7 +259,7 @@ static unsigned int generate_ns_id(int pid, unsigned int kid, struct ns_desc *nd
 	} else
 		type = NS_CRIU;
 
-	nsid = xmalloc(sizeof(*nsid));
+	nsid = xzalloc(sizeof(*nsid));
 	if (!nsid)
 		return 0;
 
-- 
2.7.3



More information about the CRIU mailing list