1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-11 20:58:50 +03:00

cov: check strdup for NULL

This commit is contained in:
Zdenek Kabelac 2020-05-15 17:22:18 +02:00
parent 33fdeaf3f1
commit ce8277b47e

View File

@ -2319,7 +2319,8 @@ static void _print_val_man(struct command_name *cname, int opt_enum, int val_enu
} }
if (strchr(str, '|')) { if (strchr(str, '|')) {
line = strdup(str); if (!(line = strdup(str)))
return;
_split_line(line, &line_argc, line_argv, '|'); _split_line(line, &line_argc, line_argv, '|');
for (i = 0; i < line_argc; i++) { for (i = 0; i < line_argc; i++) {
if (i) if (i)
@ -3606,9 +3607,12 @@ int main(int argc, char *argv[])
goto out_free; goto out_free;
} }
if (optind < argc) if (optind < argc) {
cmdname = strdup(argv[optind++]); if (!(cmdname = strdup(argv[optind++]))) {
else { log_error("Out of memory.");
goto out_free;
}
} else {
log_error("Missing command name."); log_error("Missing command name.");
goto out_free; goto out_free;
} }