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

Ruslan Kuprieiev kupruser at gmail.com
Fri Sep 20 18:19:38 EDT 2013


On 09/19/2013 02:37 PM, Andrey Vagin wrote:
> Cc: Ruslan Kuprieiev<kupruser at gmail.com>
> Signed-off-by: Andrey Vagin<avagin at openvz.org>
Original-patch-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
-------------- next part --------------
diff --git a/cr-service.c b/cr-service.c
index f4589e7..f7ecffc 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -215,7 +215,9 @@ int cr_service(bool daemon_mode)
 	socklen_t server_addr_len;
 	socklen_t client_addr_len;
 
-	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) {



More information about the CRIU mailing list