File: 05-fix-crash-xgettext-with-its.patch

package info (click to toggle)
gettext 0.19.8.1-10
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 108,980 kB
  • sloc: ansic: 388,375; sh: 51,026; makefile: 8,530; perl: 4,181; lisp: 3,413; yacc: 1,069; cpp: 673; java: 613; cs: 578; sed: 369; objc: 337; awk: 80; tcl: 63; xml: 27; pascal: 11; php: 8
file content (33 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Bruno Haible <bruno@clisp.org>
Subject: Fix crash of xgettext with --its option.
Origin: https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff_plain;h=a0cab23332a254e3500cac2a3a984472d02180e5
Bug-Debian: https://bugs.debian.org/891347
X-Debian-version: 0.19.8.1-5

--- a/gettext-tools/src/xgettext.c
+++ b/gettext-tools/src/xgettext.c
@@ -330,7 +330,7 @@
   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 @@
   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);
 }