From e7e05cae8d4bd48fb3221297fe3b388aeab47f37 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sat, 20 Jun 2015 23:38:19 +0300 Subject: [PATCH] efi/serial: fix memory leak Found by: Coverity scan. CID: 96678 --- grub-core/term/efi/serial.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c index c0911ad7b..4c94723c5 100644 --- a/grub-core/term/efi/serial.c +++ b/grub-core/term/efi/serial.c @@ -173,7 +173,10 @@ grub_efiserial_init (void) port->name = grub_malloc (sizeof ("efiXXXXXXXXXXXXXXXXXXXX")); if (!port->name) - return; + { + grub_free (port); + return; + } grub_snprintf (port->name, sizeof ("efiXXXXXXXXXXXXXXXXXXXX"), "efi%d", num_serial++);