Blame SOURCES/0046-grub-core-term-serial.c-grub_serial_register-Fix-inv.patch

f731ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f731ee
From: Vladimir Serbinenko <phcoder@gmail.com>
f731ee
Date: Sun, 26 Jan 2014 02:36:05 +0100
f731ee
Subject: [PATCH] * grub-core/term/serial.c (grub_serial_register): Fix invalid
f731ee
 free. Ensure that pointers are inited to NULL and that pointers are not
f731ee
 accessed after free.
f731ee
f731ee
---
f731ee
 grub-core/term/serial.c | 8 ++++----
f731ee
 ChangeLog               | 5 +++++
f731ee
 2 files changed, 9 insertions(+), 4 deletions(-)
f731ee
f731ee
diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c
f731ee
index b581a763ed0..c9b5574ae3c 100644
f731ee
--- a/grub-core/term/serial.c
f731ee
+++ b/grub-core/term/serial.c
f731ee
@@ -338,23 +338,23 @@ grub_serial_register (struct grub_serial_port *port)
f731ee
       grub_free (indata);
f731ee
       return grub_errno;
f731ee
     }
f731ee
-  
f731ee
-  out = grub_malloc (sizeof (*out));
f731ee
+
f731ee
+  out = grub_zalloc (sizeof (*out));
f731ee
   if (!out)
f731ee
     {
f731ee
-      grub_free (in);
f731ee
       grub_free (indata);
f731ee
       grub_free ((char *) in->name);
f731ee
+      grub_free (in);
f731ee
       return grub_errno;
f731ee
     }
f731ee
 
f731ee
   outdata = grub_malloc (sizeof (*outdata));
f731ee
   if (!outdata)
f731ee
     {
f731ee
-      grub_free (in);
f731ee
       grub_free (indata);
f731ee
       grub_free ((char *) in->name);
f731ee
       grub_free (out);
f731ee
+      grub_free (in);
f731ee
       return grub_errno;
f731ee
     }
f731ee
 
f731ee
diff --git a/ChangeLog b/ChangeLog
f731ee
index c93f11fbb20..67b4d5c2add 100644
f731ee
--- a/ChangeLog
f731ee
+++ b/ChangeLog
f731ee
@@ -1,3 +1,8 @@
f731ee
+2014-01-26  Vladimir Serbinenko  <phcoder@gmail.com>
f731ee
+
f731ee
+	* grub-core/term/serial.c (grub_serial_register): Fix invalid free.
f731ee
+	Ensure that pointers are inited to NULL and that pointers are not
f731ee
+	accessed after free.
f731ee
 
f731ee
 2014-01-25  Andrey Borzenkov <arvidjaar@gmail.com>
f731ee