cli: variable-length array declaration clang fix

Problem: Declared variable-length array can have zero size

Added a goto statement to address this issue.

Updates: bz#1622665

Change-Id: Ibf80643490367a5f7e50f66f87e4296380be45de
Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
This commit is contained in:
Sheetal Pamecha 2018-12-10 18:02:19 +05:30 committed by Amar Tumballi
parent 64d800940e
commit 2421453bf3

View File

@ -852,10 +852,12 @@ out:
#if (USE_EVENTS)
if (ret == 0 && strcmp(words[2], "help") != 0) {
ret1 = dict_get_int32(options, "count", &num_options);
if (ret1)
if (ret1) {
num_options = 0;
else
goto end;
} else {
num_options = num_options / 2;
}
char *free_list_key[num_options];
char *free_list_val[num_options];
@ -896,6 +898,7 @@ out:
}
#endif
end:
CLI_STACK_DESTROY(frame);
return ret;