misc: fix various Coverity warnings

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian
Theodore Ts'o 2016-05-17 00:53:47 -04:00
parent 0935fa8da3
commit 051fd4e028
3 changed files with 5 additions and 3 deletions

View File

@ -767,6 +767,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
com_err(__func__, retval,
_("while trying to read link \"%s\""),
name);
free(ln_target);
goto out;
}
if (read_cnt > st.st_size) {

View File

@ -726,7 +726,6 @@ static void do_set_policy(int argc, char **argv, const struct cmd_desc *cmd)
exit(1);
}
strcpy(saltbuf.key_ref_str, argv[optind]);
if ((strlen(argv[optind]) != (EXT4_KEY_DESCRIPTOR_SIZE * 2)) ||
hex2byte(argv[optind], (EXT4_KEY_DESCRIPTOR_SIZE * 2),
saltbuf.key_desc, EXT4_KEY_DESCRIPTOR_SIZE)) {
@ -737,6 +736,7 @@ static void do_set_policy(int argc, char **argv, const struct cmd_desc *cmd)
exit(1);
}
validate_paths(argc, argv, optind+1);
strcpy(saltbuf.key_ref_str, argv[optind]);
set_policy(&saltbuf, pad, argc, argv, optind+1);
exit(0);
}

View File

@ -1015,10 +1015,11 @@ static void parse_extended_opts(struct ext2_super_block *param,
quotatype_bits = 0;
ret = parse_quota_types(arg, &quotatype_bits, &errtok);
if (ret) {
if (errtok)
if (errtok) {
fprintf(stderr,
"Failed to parse quota type at %s", errtok);
else
free(errtok);
} else
com_err(program_name, ret,
"while parsing quota type");
r_usage++;