Skip to content

Commit

Permalink
readtags: initialize all fields of entry before finding a tag for it
Browse files Browse the repository at this point in the history
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 <yamato@redhat.com>
  • Loading branch information
masatake committed May 22, 2018
1 parent 9275da8 commit 8bae412
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions read/readtags.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8bae412

Please sign in to comment.