[parted-devel] [PATCH] libparted/labels/pc98.c: Fix memory leak
Will Newton
will.newton at gmail.com
Fri Jul 21 13:22:40 UTC 2017
In pc98_write if we encounter an error we can return without
freeing s0.
Signed-off-by: Will Newton <willn at resin.io>
---
libparted/labels/pc98.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index b2ce591..f18642f 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -456,8 +456,10 @@ pc98_write (const PedDisk* disk)
if (!part)
continue;
- if (!fill_raw_part (&table->partitions [i - 1], part))
+ if (!fill_raw_part (&table->partitions [i - 1], part)) {
+ free (s0);
return 0;
+ }
}
int write_ok = ped_device_write (disk->dev, table, 0, 2);
--
2.9.4
More information about the parted-devel
mailing list