Blame SOURCES/0031-Strdup-the-right-place-in-title-extraction.patch

903092
From ea7810cf3f9abe63222b50424cab0684994daeea Mon Sep 17 00:00:00 2001
903092
From: Jan Stancek <jstancek@redhat.com>
903092
Date: Tue, 11 Nov 2014 10:44:09 -0500
903092
Subject: [PATCH 31/41] Strdup the right place in title extraction.
903092
903092
Instead of strduping and then incrementing, which means we free the
903092
wrong location, strdup the incremented pointer.
903092
903092
Resolves: rhbz#1152152
903092
903092
Signed-off-by: Peter Jones <pjones@redhat.com>
903092
---
903092
 grubby.c | 5 ++---
903092
 1 file changed, 2 insertions(+), 3 deletions(-)
903092
903092
diff --git a/grubby.c b/grubby.c
903092
index 82a0f15..f7209a9 100644
903092
--- a/grubby.c
903092
+++ b/grubby.c
903092
@@ -821,11 +821,10 @@ static int isEntryStart(struct singleLine * line,
903092
 
903092
 /* extract the title from within brackets (for zipl) */
903092
 static char * extractTitle(struct singleLine * line) {
903092
-    /* bracketed title... let's extract it (leaks a byte) */
903092
+    /* bracketed title... let's extract it */
903092
     char * title = NULL;
903092
     if (line->type == LT_TITLE) {
903092
-	title = strdup(line->elements[0].item);
903092
-	title++;
903092
+	title = strdup(line->elements[0].item + 1);
903092
 	*(title + strlen(title) - 1) = '\0';
903092
     } else if (line->type == LT_MENUENTRY)
903092
 	title = strdup(line->elements[1].item);
903092
-- 
903092
2.4.3
903092