[CRIU] [PATCH 10/38] compel: Use xmalloc in argv

Cyrill Gorcunov gorcunov at openvz.org
Tue Oct 11 09:04:00 PDT 2016


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 compel/include/xmalloc.h | 1 +
 compel/src/lib/argv.c    | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
 create mode 120000 compel/include/xmalloc.h

diff --git a/compel/include/xmalloc.h b/compel/include/xmalloc.h
new file mode 120000
index 000000000000..edd6ee11a91d
--- /dev/null
+++ b/compel/include/xmalloc.h
@@ -0,0 +1 @@
+../../criu/include/xmalloc.h
\ No newline at end of file
diff --git a/compel/src/lib/argv.c b/compel/src/lib/argv.c
index 86f354e83679..86277ef3a80a 100644
--- a/compel/src/lib/argv.c
+++ b/compel/src/lib/argv.c
@@ -3,6 +3,8 @@
 
 #include "uapi/compel.h"
 
+#include "xmalloc.h"
+
 int libcompel_pack_argv(void *blob, size_t blob_size,
 			int argc, char **argv,
 			void **arg_p, size_t *arg_size)
@@ -17,7 +19,7 @@ int libcompel_pack_argv(void *blob, size_t blob_size,
 	for (i = 0; i < argc; i++)
 		total_len += sizeof(unsigned long) + strlen(argv[i]) + 1;
 
-	argc_packed = malloc(total_len);
+	argc_packed = xmalloc(total_len);
 	if (!argc_packed)
 		return -ENOMEM;
 
-- 
2.7.4



More information about the CRIU mailing list