diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2015-12-27 08:54:34 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-12-28 12:48:27 -0800 |
commit | 2653a8c6fa0466828061a3132421cf13a5d6d924 (patch) | |
tree | 5b7a8f162f290b1d9272f5119060c70e5ec31929 /dir.c | |
parent | Git 2.2.3 (diff) | |
download | tgif-2653a8c6fa0466828061a3132421cf13a5d6d924.tar.xz |
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>
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -501,9 +501,7 @@ void clear_exclude_list(struct exclude_list *el) free(el->excludes); free(el->filebuf); - el->nr = 0; - el->excludes = NULL; - el->filebuf = NULL; + memset(el, 0, sizeof(*el)); } static void trim_trailing_spaces(char *buf) |