Projects
Eulaceura:Mainline:GA
parted
_service:obs_scm:0009-fat_clobber-set-boot_sect...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0009-fat_clobber-set-boot_sector-NULL-and-free-boot_secto.patch of Package parted
From 1512dc33b36ad0feff9dbdcfe38e6d2acdcb38a0 Mon Sep 17 00:00:00 2001 From: Li Jinlin <lijinlin3@huawei.com> Date: Tue, 29 Mar 2022 11:10:19 +0800 Subject: [PATCH 6/6] fat_clobber: set boot_sector = NULL and free boot_sector after failed of fat_boot_sector_read When fat_boot_sector_read() returns failure, boot_sector may have allocated memory, and memory leak will occur Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> Signed-off-by: Li Jinlin <lijinlin3@huawei.com> --- libparted/fs/r/fat/fat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c index 396494a..33a4284 100644 --- a/libparted/fs/r/fat/fat.c +++ b/libparted/fs/r/fat/fat.c @@ -117,11 +117,13 @@ fat_set_frag_sectors (PedFileSystem* fs, PedSector frag_sectors) int fat_clobber (PedGeometry* geom) { - FatBootSector *boot_sector; + FatBootSector *boot_sector = NULL; int ok; - if (!fat_boot_sector_read (&boot_sector, geom)) + if (!fat_boot_sector_read (&boot_sector, geom)) { + free(boot_sector); return 1; + } boot_sector->system_id[0] = 0; boot_sector->boot_sign = 0; -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2