efi/serial: fix memory leak

Found by: Coverity scan.
CID: 96678
This commit is contained in:
Andrei Borzenkov 2015-06-20 23:38:19 +03:00
parent 47490ada3d
commit e7e05cae8d

View file

@ -173,7 +173,10 @@ grub_efiserial_init (void)
port->name = grub_malloc (sizeof ("efiXXXXXXXXXXXXXXXXXXXX"));
if (!port->name)
{
grub_free (port);
return;
}
grub_snprintf (port->name, sizeof ("efiXXXXXXXXXXXXXXXXXXXX"),
"efi%d", num_serial++);