mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
fs: ext4fs: Use unwind goto to free memory on error
Ensure that allocated memory is freed on error exit replace the direct return calls with 'goto fail'. This issue found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
This commit is contained in:
committed by
Tom Rini
parent
a7e44898b4
commit
36f05e6224
@@ -877,19 +877,19 @@ int ext4fs_write(const char *fname, const char *buffer,
|
||||
|
||||
if (ext4fs_init() != 0) {
|
||||
printf("error in File System init\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
missing_feat = le32_to_cpu(fs->sb->feature_incompat) & ~EXT4_FEATURE_INCOMPAT_SUPP;
|
||||
if (missing_feat) {
|
||||
log_err("Unsupported features found %08x, not writing.\n", missing_feat);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
missing_feat = le32_to_cpu(fs->sb->feature_ro_compat) & ~EXT4_FEATURE_RO_COMPAT_SUPP;
|
||||
if (missing_feat) {
|
||||
log_err("Unsupported RO compat features found %08x, not writing.\n", missing_feat);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
inodes_per_block = fs->blksz / fs->inodesz;
|
||||
|
||||
Reference in New Issue
Block a user