[PATCH] plug leak in ped_device_get_constraint

Jim Meyering meyering at redhat.com
Thu May 29 17:38:09 UTC 2008


496 (208 direct, 288 indirect) bytes in 5 blocks are definitely lost...
   at 0x4A0739E: malloc (vg_replace_malloc.c:207)
   by 0x416EDF: ped_malloc (libparted.c:270)
   by 0x41CB40: ped_geometry_new (geom.c:79)
   by 0x415167: ped_device_get_constraint (device.c:438)
   by 0x40B928: do_mkpartfs (parted.c:927)
   by 0x40A055: command_run (command.c:139)
   by 0x41217C: non_interactive_mode (ui.c:1540)
   by 0x40EEB1: main (parted.c:2497)
---
 libparted/device.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libparted/device.c b/libparted/device.c
index 6595572..b951dd2 100644
--- a/libparted/device.c
+++ b/libparted/device.c
@@ -431,12 +431,15 @@ ped_device_get_constraint (PedDevice* dev)

         PedAlignment* start_align = ped_alignment_new (multiplier, multiplier);
         
+        PedGeometry *s, *e;
         PedConstraint* c = ped_constraint_new (
                                 start_align, ped_alignment_any,
-                                ped_geometry_new (dev, 0, dev->length),
-                                ped_geometry_new (dev, 0, dev->length),
+                                s = ped_geometry_new (dev, 0, dev->length),
+                                e = ped_geometry_new (dev, 0, dev->length),
                                 1, dev->length);

+        free (s);
+        free (e);
         free (start_align);
         return c;
 }
-- 
1.5.6.rc0.30.g7c3f3




More information about the parted-devel mailing list