[Parted-commits] GNU Parted Official Repository: Changes to 'next'
Jim Meyering
meyering at alioth.debian.org
Fri Jul 10 21:02:45 UTC 2009
libparted/labels/dos.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
New commits:
commit 0c4f1a767dbf1aa84d8d0d62ea6e8c4b7893994e
Author: Jim Meyering <meyering at redhat.com>
Date: Fri Jul 10 23:02:36 2009 +0200
dos: plug just-introduced leaks on error path
* libparted/labels/dos.c (write_ext_table): Also free new buffer
on error paths.
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 2174abc..1d4c2dd 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1041,8 +1041,9 @@ write_ext_table (const PedDisk* disk,
DosRawTable *table = s;
table->magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
+ int ok = 0;
if (!fill_raw_part (&table->partitions[0], logical, sector))
- return 0;
+ goto cleanup;
part = ped_disk_get_partition (disk, logical->num + 1);
if (part) {
@@ -1052,17 +1053,18 @@ write_ext_table (const PedDisk* disk,
geom = ped_geometry_new (disk->dev, part->prev->geom.start,
part->geom.end - part->prev->geom.start + 1);
if (!geom)
- return 0;
+ goto cleanup;
partition_probe_bios_geometry (part, &bios_geom);
fill_ext_raw_part_geom (&table->partitions[1], &bios_geom,
geom, lba_offset);
ped_geometry_destroy (geom);
if (!write_ext_table (disk, part->prev->geom.start, part))
- return 0;
+ goto cleanup;
}
- int ok = ped_device_write (disk->dev, table, sector, 1);
+ ok = ped_device_write (disk->dev, table, sector, 1);
+ cleanup:
free (s);
return ok;
}
More information about the Parted-commits
mailing list