Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP3:Update
exfatprogs
0008-fsck-fix-memory-leaks-in-restore_boot_regi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0008-fsck-fix-memory-leaks-in-restore_boot_region-error-p.patch of Package exfatprogs
From 648116de24779dc5cb7d471afe377d8fb8bb4a8e Mon Sep 17 00:00:00 2001 From: Christophe Vu-Brugier <cvubrugier@fastmail.fm> Date: Sat, 27 Feb 2021 10:55:38 +0100 Subject: [PATCH 8/9] fsck: fix memory leaks in restore_boot_region() error paths Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm> (cherry picked from commit 0ab362327a775cd71549fba9c9ef53e4320f4a97) Acked-by: David Disseldorp <ddiss@suse.de> --- fsck/fsck.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 46c8943..747a771 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -736,6 +736,7 @@ static int restore_boot_region(struct exfat_blk_dev *bd) { int i; char *sector; + int ret; sector = malloc(bd->sector_size); if (!sector) @@ -745,21 +746,31 @@ static int restore_boot_region(struct exfat_blk_dev *bd) if (exfat_read(bd->dev_fd, sector, bd->sector_size, BACKUP_BOOT_SEC_IDX * bd->sector_size + i * bd->sector_size) != - (ssize_t)bd->sector_size) - return -EIO; + (ssize_t)bd->sector_size) { + ret = -EIO; + goto free_sector; + } if (i == 0) ((struct pbr *)sector)->bsx.perc_in_use = 0xff; if (exfat_write(bd->dev_fd, sector, bd->sector_size, BOOT_SEC_IDX * bd->sector_size + i * bd->sector_size) != - (ssize_t)bd->sector_size) - return -EIO; + (ssize_t)bd->sector_size) { + ret = -EIO; + goto free_sector; + } } - if (fsync(bd->dev_fd)) - return -EIO; + + if (fsync(bd->dev_fd)) { + ret = -EIO; + goto free_sector; + } + ret = 0; + +free_sector: free(sector); - return 0; + return ret; } static int exfat_boot_region_check(struct exfat *exfat, struct pbr **bs) -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor