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

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