From 8bae41287f5e2f1d53de756c66264ba25d05b976 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Tue, 22 May 2018 12:49:53 +0900 Subject: [PATCH] readtags: initialize all fields of entry before finding a tag for it When a broken tags file was given, valgrind reported entry->file is not initialized. Here, "broken tags file" means a tags file having a line with a non-terminated pattern. Signed-off-by: Masatake YAMATO --- read/readtags.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/read/readtags.c b/read/readtags.c index 1fa854466f..d026b7e092 100644 --- a/read/readtags.c +++ b/read/readtags.c @@ -403,10 +403,7 @@ static void parseTagLine (tagFile *file, tagEntry *const entry) size_t p_len = strlen (p); char *tab = strchr (p, TAB); - entry->fields.list = NULL; - entry->fields.count = 0; - entry->kind = NULL; - entry->fileScope = 0; + memset(entry, 0, sizeof(*entry)); entry->name = p; if (tab != NULL)