1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

cov: ensure cname exists before derefering it

Just make it clear to analyzers  cname can't be NULL.
TODO: maybe exclude NULL at front of the function...
This commit is contained in:
Zdenek Kabelac 2019-06-25 15:29:26 +02:00
parent 46f1d17c74
commit cc4a92b13c

View File

@ -1935,7 +1935,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
* see print_common_options_cmd()
*/
if ((cname->variants > 1) && cname->common_options[opt_enum])
if (cname && (cname->variants > 1) && cname->common_options[opt_enum])
continue;
printf("\n\t[");
@ -1975,7 +1975,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
* see print_common_options_cmd()
*/
if ((cname->variants > 1) && cname->common_options[opt_enum])
if (cname && (cname->variants > 1) && cname->common_options[opt_enum])
continue;
printf("\n\t[");
@ -3438,7 +3438,7 @@ static int _print_man(char *name, char *des_file, int secondary)
if (!prev_cmd || strcmp(prev_cmd->name, cmd->name)) {
printf(".SH NAME\n");
if (cname->desc)
if (cname && cname->desc)
printf("%s - %s\n", lvmname, cname->desc);
else
printf("%s\n", lvmname);