dir.c: clean the entire struct in clear_exclude_list()
Make sure "el" can be reuseable again. The problem was el->alloc is not cleared and may cause segfaults next time because add_exclude() thinks el->excludes (being NULL) has enough space. Just clear the entire struct to be safe. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
441c4a4017
commit
2653a8c6fa
4
dir.c
4
dir.c
@ -501,9 +501,7 @@ void clear_exclude_list(struct exclude_list *el)
|
|||||||
free(el->excludes);
|
free(el->excludes);
|
||||||
free(el->filebuf);
|
free(el->filebuf);
|
||||||
|
|
||||||
el->nr = 0;
|
memset(el, 0, sizeof(*el));
|
||||||
el->excludes = NULL;
|
|
||||||
el->filebuf = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void trim_trailing_spaces(char *buf)
|
static void trim_trailing_spaces(char *buf)
|
||||||
|
Reference in New Issue
Block a user