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