From 7f7716f8194e06754d0417f27bcc40638c9f9f83 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Wed, 5 Dec 2018 12:33:48 +0530 Subject: cli: fix memory leak in cli/src/cli-rpc-ops.c This Patch fixes memory leak reported by ASan. Leaks are in gf_cli_status_cbk as a result of allocatating memory using gf_asprintf in loop. SUMMARY: AddressSanitizer: 535 byte(s) leaked in 7 allocation(s). Change-Id: If2fd76c7c1ea6fc44baca295050800074f9d1323 updates: bz#1633930 Signed-off-by: Sunny Kumar --- cli/src/cli-rpc-ops.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index e1422cfd68a..4c212d6cde9 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -8479,6 +8479,9 @@ gf_cli_status_cbk(struct rpc_req *req, struct iovec *iov, int count, } else { cli_print_brick_status(&status); } + + /* Allocatated memory using gf_asprintf*/ + GF_FREE(status.pid_str); } cli_out(" "); -- cgit