From 947523a74c97b057b8bcfdf2c65943495ab118d2 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Fri, 21 Sep 2012 15:38:07 +0530 Subject: cli: removed extra dict unrefs and memory leaks PROBLEMS ADDRESSED: a. The following change http://review.gluster.com/#change,3948 introduces extra dict unrefs in cli. b. There are instances of memory leak in gf_cli_*_cbk functions. FIX: Problem (a) is fixed by ensuring the dict is ref'd (indirectly at the time of creation) and unref'd (in CLI_STACK_DESTROY) ONLY once. The following is the rationale behind this approach: The number of refs and unrefs on dict varies across the different commands that use it. The cli thread MUST wait for the gf_cli_*_cbks to complete before the frame is destroyed. This rules out the need to do extra refs and unrefs in the code path. Problem (b) is fixed by doing unref on dicts that are created for the purpose of unserializing the response but never freed in gf_cli_*_cbk functions. Change-Id: I5a7431543fc8e3cac4d256f5c87d1e3c62a331be BUG: 823081 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/3966 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cli/src/cli.h') diff --git a/cli/src/cli.h b/cli/src/cli.h index 0299220ce..7aa2148f4 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -272,6 +272,10 @@ int cli_cmd_volume_heal_options_parse (const char **words, int wordcount, dict_t **options); +int +cli_cmd_volume_defrag_parse (const char **words, int wordcount, + dict_t **options); + int cli_print_brick_status (cli_volume_status_t *status); -- cgit