[CRIU] [PATCH 1/3] cgroup: Use xmalloc in rewrite_cgsets

Cyrill Gorcunov gorcunov at openvz.org
Tue Sep 23 10:00:23 PDT 2014


We prefer x* helpers because they print error
in case of allocation failures.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cgroup.c b/cgroup.c
index 73d409f6fea8..fc220c9bea09 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -1244,7 +1244,7 @@ static int rewrite_cgsets(CgroupEntry *cge, char **controllers, int n_controller
 
 				/* +1 for trailing NULL */
 				int newlen = strlen(to) + strlen(cg->path + off) + 1;
-				char *m = malloc(newlen * sizeof(char*));
+				char *m = xmalloc(newlen * sizeof(char*));
 				if (!m)
 					return -1;
 
-- 
1.9.3



More information about the CRIU mailing list