[CRIU] [PATCH 5/5] service: check errors of xmalloc

Andrey Vagin avagin at openvz.org
Thu Sep 19 06:37:48 EDT 2013


Cc: Ruslan Kuprieiev <kupruser at gmail.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-service.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cr-service.c b/cr-service.c
index 514bd44..a1568da 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -213,7 +213,9 @@ int cr_service(bool daemon_mode)
 
 	CriuMsg *msg = 0;
 
-	cr_service_client = malloc(sizeof(struct _cr_service_client));
+	cr_service_client = xmalloc(sizeof(struct _cr_service_client));
+	if (cr_service_client == NULL)
+		goto err;
 
 	server_fd = socket(AF_LOCAL, SOCK_SEQPACKET, 0);
 	if (server_fd == -1) {
-- 
1.8.3.1



More information about the CRIU mailing list