[Parted-maintainers] Bug#548436: new patch, known working

Robert Millan rmh at aybabtu.com
Wed Dec 9 20:58:22 UTC 2009


On Wed, Dec 09, 2009 at 12:29:15PM +0100, Aurelien Jarno wrote:
> > diff -ur parted-1.8.8.git.2009.07.19/libparted/arch/freebsd.c parted-1.8.8.git.2009.07.19.new/libparted/arch/freebsd.c
> > --- parted-1.8.8.git.2009.07.19/libparted/arch/freebsd.c	2009-11-21 10:35:29.000000000 +0100
> > +++ parted-1.8.8.git.2009.07.19.new/libparted/arch/freebsd.c	2009-11-21 10:35:56.000000000 +0100
> > @@ -1110,13 +1110,18 @@
> >  	int		path_len = strlen (dev->path);
> >  	int		result_len = path_len + 16;
> >  	char*		result;
> > +	PedDisk*	disk;
> > +
> > +	disk = ped_disk_new (dev);
> > +	if (!disk)
> > +		return NULL;
> >  
> >  	result = (char*) ped_malloc (result_len);
> >  	if (!result)
> >  		return NULL;
> >  
> >  	/* append slice number (ad0, partition 1 => ad0s1)*/
> > -	snprintf (result, result_len, "%ss%d", dev->path, num);
> > +	snprintf (result, result_len, strcmp (disk->type->name, "gpt") ? "%ss%d" : "%sp%d", dev->path, num);
> >  	
> >  	return result;
> 
> Shouldn't disk be freed after use?

Good catch.  This needed a new variable to cope with the !result early
return.  Here's a new patch.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpt.diff
Type: text/x-diff
Size: 887 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-maintainers/attachments/20091209/f7d1159c/attachment.diff>


More information about the Parted-maintainers mailing list