summaryrefslogtreecommitdiff
path: root/f2fs_utils
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2018-05-15 15:59:04 -0700
committerGeorge Burgess IV <gbiv@google.com>2018-05-15 15:59:04 -0700
commit4adef522cc8eb4915faaea59bda404280ba2da2a (patch)
tree5b68231abea60d43283f9f7956ece4ddb67ff05f /f2fs_utils
parenta1b34a8173609094df0e124ecca19b619fc19a41 (diff)
downloadextras-4adef522cc8eb4915faaea59bda404280ba2da2a.tar.gz
Fix a double-free
On an error here, we'd free `info->sit_blocks` just above this line, return to `generate_f2fs_info`, jump to the `error` label, and call `free_f2fs_info`. `free_f2fs_info` helpfully frees `info->sit_blocks`. Caught by the static analyzer. Bug: None Test: Static analyzer no longer complains. Change-Id: I52a158b35f19736b0bfd9cccf969f8fca9237928
Diffstat (limited to 'f2fs_utils')
-rw-r--r--f2fs_utils/f2fs_sparseblock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/f2fs_utils/f2fs_sparseblock.c b/f2fs_utils/f2fs_sparseblock.c
index 95268d0e..c77b626c 100644
--- a/f2fs_utils/f2fs_sparseblock.c
+++ b/f2fs_utils/f2fs_sparseblock.c
@@ -333,6 +333,7 @@ static int gather_sit_info(int fd, struct f2fs_info *info)
if (read_structure(fd, address * F2FS_BLKSIZE, &info->sit_blocks[sit_block], sizeof(struct f2fs_sit_block))) {
SLOGE("Could not read sit block at block %"PRIu64, address);
free(info->sit_blocks);
+ info->sit_blocks = NULL;
return -1;
}
}