diff --git a/main/gettext/APKBUILD b/main/gettext/APKBUILD
index 6c092dd8796855f6d5040e01afb6233b5b407cec..4d998ea6b9bd9de8932b0b94a93e3b351c5034d4 100644
--- a/main/gettext/APKBUILD
+++ b/main/gettext/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Carlo Landmeter <clandmeter@gmail.com>
 pkgname=gettext
 pkgver=0.19.8.1
-pkgrel=3
+pkgrel=4
 pkgdesc="GNU locale utilities"
 url="https://www.gnu.org/software/gettext/gettext.html"
 arch="all"
@@ -19,6 +19,7 @@ source="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz
 	skip-tests-musl.patch
 	skip-tests-alpine.patch
 	unbundle-libunistring.patch
+	fix-crash-of-xgettext-with--its-option.patch
 	"
 subpackages="$pkgname-dbg $pkgname-doc $pkgname-static $pkgname-dev $pkgname-lang libintl $pkgname-asprintf $pkgname-libs"
 
@@ -80,4 +81,5 @@ f517a351864bb194117e7147015db9a9b0ffbb1feb22ecf39bc1c99ad904420467e267a893c3b1a7
 2765f8d9d72d85ad0adb87ee0edd83d3aec59995ef21a3c8bbd1ac20a3680058a2122bd3f6c37be3f50cb5ea00c19b3ad569a47ceedc8ae2cb4a6e8d4e30976d  localename-fix.patch
 8fced6ec5c1f54686545aa91759f8501a0ccfa4bb66a781d282e65f7309c70ab74bf753f4969374facb135b7b9341e26d8a3e27679ea09cb1543b82dfb8a16dd  skip-tests-musl.patch
 4171b52abb9a34cc30ad9d737a6d4fc94d7365781f13522eef9111e2fc34f08f3206508471b2c2ab70ae95ecb110bc569535ca949bded3e8896c83e9d752d06e  skip-tests-alpine.patch
-86dcba9b53048b01c8912bdcfc7e9372a37f196352ef366d5192af204cb1bad95c31803991e0a408ab16b0c7094846df5ef95243bb09894e3dc9b3c4e5daaa43  unbundle-libunistring.patch"
+86dcba9b53048b01c8912bdcfc7e9372a37f196352ef366d5192af204cb1bad95c31803991e0a408ab16b0c7094846df5ef95243bb09894e3dc9b3c4e5daaa43  unbundle-libunistring.patch
+3ad909028d887429248b79ef3f2289d8934a5dd9337e51abbf05cece2fed3e2b12d228a587ebcbd0e775380b86825a6f796d2d0392b24384f5f8d298f78965ea  fix-crash-of-xgettext-with--its-option.patch"
diff --git a/main/gettext/fix-crash-of-xgettext-with--its-option.patch b/main/gettext/fix-crash-of-xgettext-with--its-option.patch
new file mode 100644
index 0000000000000000000000000000000000000000..49fde4f4c7bde109ca75a7f421ce12a583f98e8d
--- /dev/null
+++ b/main/gettext/fix-crash-of-xgettext-with--its-option.patch
@@ -0,0 +1,43 @@
+From a0cab23332a254e3500cac2a3a984472d02180e5 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Fri, 9 Dec 2016 21:04:31 +0100
+Subject: Fix crash of xgettext with --its option.
+
+* 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 | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c
+index f848d76..a80ee51 100644
+--- a/gettext-tools/src/xgettext.c
++++ b/gettext-tools/src/xgettext.c
+@@ -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);
+ }
+-- 
+cgit v1.0-41-gc330
+