From 7162c8ad9d404773656b4eb02c8fc17f067e7699 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Wed, 5 Jun 2019 20:16:40 +0300 Subject: cli: defer create_frame() (and dict creation) to later stages. Where possible, defer create_frame() - whenever possible, after command line verification, for example. Change-Id: Id6606e90e7ea6190f30b225c4733b229c519bb2f updates: bz#1193929 Signed-off-by: Yaniv Kaul --- cli/src/cli-cmd-global.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cli/src/cli-cmd-global.c') diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c index d0729ac1f0a..d7c4d97ad72 100644 --- a/cli/src/cli-cmd-global.c +++ b/cli/src/cli-cmd-global.c @@ -101,10 +101,6 @@ cli_cmd_get_state_cbk(struct cli_state *state, struct cli_cmd_word *word, cli_local_t *local = NULL; char *op_errstr = NULL; - frame = create_frame(THIS, THIS->ctx->pool); - if (!frame) - goto out; - ret = cli_cmd_get_state_parse(state, words, wordcount, &options, &op_errstr); @@ -120,6 +116,12 @@ cli_cmd_get_state_cbk(struct cli_state *state, struct cli_cmd_word *word, goto out; } + frame = create_frame(THIS, THIS->ctx->pool); + if (!frame) { + ret = -1; + goto out; + } + CLI_LOCAL_INIT(local, words, frame, options); proc = &cli_rpc_prog->proctable[GLUSTER_CLI_GET_STATE]; -- cgit