]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix crash of xgettext with --its option.
authorBruno Haible <bruno@clisp.org>
Fri, 9 Dec 2016 20:04:31 +0000 (21:04 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 9 Dec 2016 20:04:31 +0000 (21:04 +0100)
* gettext-tools/src/xgettext.c (main): Free contents of its_dirs only when it
was initialized. Fixes bug introduced on 2016-05-16.

gettext-tools/src/xgettext.c

index f848d76d1cb11c40767d0b2f117e015b2f9e6473..a80ee51ac390117a4b2576d3e1a061ebd22cd3d4 100644 (file)
@@ -330,7 +330,7 @@ main (int argc, char *argv[])
   bool sort_by_msgid = false;
   bool sort_by_filepos = false;
   char **dirs;
-  char **its_dirs;
+  char **its_dirs = NULL;
   char *explicit_its_filename = NULL;
   const char *file_name;
   const char *files_from = NULL;
@@ -1016,9 +1016,12 @@ warning: file '%s' extension '%s' is unknown; will try C"), filename, extension)
   if (its_locating_rules)
     locating_rule_list_free (its_locating_rules);
 
-  for (i = 0; its_dirs[i] != NULL; i++)
-    free (its_dirs[i]);
-  free (its_dirs);
+  if (its_dirs != NULL)
+    {
+      for (i = 0; its_dirs[i] != NULL; i++)
+        free (its_dirs[i]);
+      free (its_dirs);
+    }
 
   exit (EXIT_SUCCESS);
 }