[PATCH] plug leaks in gpt_write
Jim Meyering
meyering at redhat.com
Thu May 29 18:47:44 UTC 2008
* libparted/labels/gpt.c (gpt_write):
6,674 bytes in 11 blocks are definitely lost...
at 0x4A0739E: malloc (vg_replace_malloc.c:207)
by 0x416F1B: ped_malloc (libparted.c:270)
by 0x43E76D: pth_new (gpt.c:289)
by 0x43E7E2: pth_new_zeroed (gpt.c:298)
by 0x43FF61: _generate_header (gpt.c:970)
by 0x440434: gpt_write (gpt.c:1074)
by 0x418F9A: ped_disk_commit_to_dev (disk.c:486)
by 0x418FE0: ped_disk_commit (disk.c:509)
by 0x40BB35: do_mkpartfs (parted.c:990)
---
libparted/labels/gpt.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 5be0235..0d8357b 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1065,6 +1065,7 @@ gpt_write(const PedDisk * disk)
/* Write PTH and PTEs */
_generate_header (disk, 0, ptes_crc, &gpt);
pth_raw = pth_get_raw (disk->dev, gpt);
+ pth_free (gpt);
if (!ped_device_write (disk->dev, pth_raw, 1, 1))
goto error_free_ptes;
if (!ped_device_write (disk->dev, ptes, 2, ptes_size / disk->dev->sector_size))
@@ -1073,6 +1074,7 @@ gpt_write(const PedDisk * disk)
/* Write Alternate PTH & PTEs */
_generate_header (disk, 1, ptes_crc, &gpt);
pth_raw = pth_get_raw (disk->dev, gpt);
+ pth_free (gpt);
if (!ped_device_write (disk->dev, pth_raw, disk->dev->length - 1, 1))
goto error_free_ptes;
if (!ped_device_write (disk->dev, ptes,
--
1.5.6.rc0.30.g7c3f3
More information about the parted-devel
mailing list