Skip to content

Commit

Permalink
f2fs-tools: fixed incorrect error handling
Browse files Browse the repository at this point in the history
Case of failed memory allocation of dev->zone_cap_blocks
doesn't release heap allocated rep
Found by RASU JSC
Fixes: f841085(f2fs-tools: zns zone-capacity support)
Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
ProjectMutilation authored and Jaegeuk Kim committed Nov 28, 2023
1 parent 68abdf3 commit 00efc38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/libf2fs_zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ int f2fs_check_zones(int j)

dev->zone_cap_blocks = malloc(dev->nr_zones * sizeof(size_t));
if (!dev->zone_cap_blocks) {
free(rep);
ERR_MSG("No memory for zone capacity list.\n");
return -ENOMEM;
}
Expand Down

0 comments on commit 00efc38

Please sign in to comment.