Message ID | 20231120075504.455510-1-korotkov.maxim.s@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev,v2] f2fs-tools: fixed incorrect error handling | expand |
On 2023/11/20 15:55, Maxim Korotkov wrote: > Case of failed memory allocation of dev->zone_cap_blocks > doesn't release heap allocated rep > Found by RASU JSC > Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support) > Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c index 56c97d1..81088af 100644 --- a/lib/libf2fs_zoned.c +++ b/lib/libf2fs_zoned.c @@ -293,6 +293,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; }
Case of failed memory allocation of dev->zone_cap_blocks doesn't release heap allocated rep Found by RASU JSC Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support) Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru> --- changeset: - editted description lib/libf2fs_zoned.c | 1 + 1 file changed, 1 insertion(+)