[PATCH] libparted: avoid double-free on an OOM failure path

Jim Meyering meyering at redhat.com
Fri Jan 15 17:56:37 UTC 2010


* libparted/disk.c (ped_disk_check): Don't double-free "fs_size".
---
 libparted/disk.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libparted/disk.c b/libparted/disk.c
index c14d005..2d27b7c 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -630,11 +630,13 @@ ped_disk_check (const PedDisk* disk)
 				_("Partition %d is %s, but the file system is "
 				  "%s."),
 				walk->num, part_size, fs_size);

 			free (part_size);
+
 			free (fs_size);
+			fs_size = NULL;

 			if (choice != PED_EXCEPTION_IGNORE)
 				return 0;
 		}
 		free (fs_size);
--
1.6.6.556.gd6679



More information about the parted-devel mailing list