From 445293654d92a1dabb04255547730b35c5cde387 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 17 Dec 2015 16:04:40 +0200 Subject: [PATCH] Fix eventual dereference of uninitialized pointer. * src/exclist.c (hg_initfn): Initialize hgopt. --- src/exclist.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/exclist.c b/src/exclist.c index c24a00c5..0b7c987f 100644 --- a/src/exclist.c +++ b/src/exclist.c @@ -250,12 +250,8 @@ bzr_addfn (struct exclude *ex, char const *pattern, int options, void *data) static void * hg_initfn (void *data) { - int *hgopt; static int hg_options; - - if (!data) - hgopt = &hg_options; - + int *hgopt = data ? data : &hg_options; *hgopt = EXCLUDE_REGEX; return hgopt; } @@ -307,7 +303,7 @@ static struct vcs_ignore_file vcs_ignore_files[] = { { ".cvsignore", EXCL_NON_RECURSIVE, cvs_addfn, NULL, NULL }, { ".gitignore", 0, git_addfn, NULL, NULL }, { ".bzrignore", 0, bzr_addfn, NULL, NULL }, - { ".hgignore", 0, hg_addfn, hg_initfn , NULL }, + { ".hgignore", 0, hg_addfn, hg_initfn, NULL }, { NULL, 0, git_addfn, NULL, NULL } }; -- 2.47.2