On Tue, 2009-04-28 at 01:59 -0700, David Miller wrote:

> I think it's overkill at the moment.

I've committed the patch with grub_malloc() and the patch making
grub_fs_uuid_close() use grub_device_close().

> > +/* Return partition to be freed if it can be freed.  */
> > +static inline grub_partition_t
> > +grub_partition_unref (const grub_partition_t p)
> > +{
> > +  if (p && p->refcount-- <= 0)
> > +    return p;
> 
> If the reference count dips below zero, that should trigger
> an assertion rather than giving the pointer to the caller
> again which will potentially double-free memory or whatever.

Correct.  If we have a better case for using refcounts, we'll have that
check.

-- 
Regards,
Pavel Roskin


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to