]> git.gag.com Git - debian/tar/commitdiff
Fix eventual dereference of uninitialized pointer.
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 17 Dec 2015 14:04:40 +0000 (16:04 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 17 Dec 2015 14:04:40 +0000 (16:04 +0200)
* src/exclist.c (hg_initfn): Initialize hgopt.

src/exclist.c

index c24a00c5312176d7eeba1cb15b1e589c17f5d5cc..0b7c987f6c9b83af2ae35ee5dafcf0abc2c1d7c2 100644 (file)
@@ -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 }
 };