xnu: fix use after free

Found by: Coverity scan.
CID: 96706
This commit is contained in:
Andrei Borzenkov 2015-06-20 23:38:18 +03:00
parent cd816bd236
commit e261fcf4c6

View file

@ -269,9 +269,9 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev,
prop->data = grub_malloc (prop->length); prop->data = grub_malloc (prop->length);
if (!prop->data) if (!prop->data)
{ {
grub_free (prop);
grub_free (prop->name); grub_free (prop->name);
grub_free (prop->name16); grub_free (prop->name16);
grub_free (prop);
return grub_errno; return grub_errno;
} }
grub_memcpy (prop->data, data, prop->length); grub_memcpy (prop->data, data, prop->length);