Blame SOURCES/gettext-0.19.8-its-segfault.patch

91571f
From a0cab23332a254e3500cac2a3a984472d02180e5 Mon Sep 17 00:00:00 2001
91571f
From: Bruno Haible <bruno@clisp.org>
91571f
Date: Fri, 9 Dec 2016 21:04:31 +0100
91571f
Subject: [PATCH] Fix crash of xgettext with --its option.
91571f
91571f
* gettext-tools/src/xgettext.c (main): Free contents of its_dirs only when it
91571f
was initialized. Fixes bug introduced on 2016-05-16.
91571f
---
91571f
 gettext-tools/src/xgettext.c | 11 +++++++----
91571f
 1 file changed, 7 insertions(+), 4 deletions(-)
91571f
91571f
diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c
91571f
index f848d76d1..a80ee51ac 100644
91571f
--- a/gettext-tools/src/xgettext.c
91571f
+++ b/gettext-tools/src/xgettext.c
91571f
@@ -330,7 +330,7 @@ main (int argc, char *argv[])
91571f
   bool sort_by_msgid = false;
91571f
   bool sort_by_filepos = false;
91571f
   char **dirs;
91571f
-  char **its_dirs;
91571f
+  char **its_dirs = NULL;
91571f
   char *explicit_its_filename = NULL;
91571f
   const char *file_name;
91571f
   const char *files_from = NULL;
91571f
@@ -1016,9 +1016,12 @@ warning: file '%s' extension '%s' is unknown; will try C"), filename, extension)
91571f
   if (its_locating_rules)
91571f
     locating_rule_list_free (its_locating_rules);
91571f
 
91571f
-  for (i = 0; its_dirs[i] != NULL; i++)
91571f
-    free (its_dirs[i]);
91571f
-  free (its_dirs);
91571f
+  if (its_dirs != NULL)
91571f
+    {
91571f
+      for (i = 0; its_dirs[i] != NULL; i++)
91571f
+        free (its_dirs[i]);
91571f
+      free (its_dirs);
91571f
+    }
91571f
 
91571f
   exit (EXIT_SUCCESS);
91571f
 }
91571f
-- 
91571f
2.14.3
91571f