From 1c2ebcddb0e7e72ca40bae07419afbe958dfa60a Mon Sep 17 00:00:00 2001 From: Humble Devassy Chirammal Date: Tue, 7 Apr 2015 11:27:19 +0530 Subject: cli: Error out when there is not enough memory Change-Id: Ia8d061de5be1343cc10a945f6cf011686a770d33 BUG: 1220020 Signed-off-by: Humble Devassy Chirammal Reviewed-on: http://review.gluster.org/10144 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Vijay Bellur (cherry picked from commit f6e24fc54453669f3943e50f44cce9bb6070a71a) Reviewed-on: http://review.gluster.org/10674 Reviewed-by: Kaushal M Tested-by: Kaushal M --- cli/src/cli-rpc-ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-rpc-ops.c') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 080c225e64d..5361e83a1f6 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -6994,7 +6994,11 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov, } status.brick = GF_CALLOC (1, PATH_MAX + 256, gf_common_mt_strdup); - + if (!status.brick) { + errno = ENOMEM; + ret = -1; + goto out; + } switch (cmd & GF_CLI_STATUS_MASK) { case GF_CLI_STATUS_MEM: cli_print_volume_status_mem (dict, notbrick); -- cgit