about summary refs log tree commit diff
path: root/intl
diff options
context:
space:
mode:
Diffstat (limited to 'intl')
-rw-r--r--intl/Makefile31
-rw-r--r--intl/dcigettext.c14
-rw-r--r--intl/tst-gettext.c4
-rwxr-xr-xintl/tst-gettext.sh2
4 files changed, 19 insertions, 32 deletions
diff --git a/intl/Makefile b/intl/Makefile
index 966dad3e82..e6fa79643f 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -50,10 +50,13 @@ ifeq (no,$(cross-compiling))
 ifeq (yes,$(build-shared))
 ifneq ($(strip $(MSGFMT)),:)
 .PHONY: do-gettext-test do-translit-test
-tests: do-gettext-test do-translit-test
+tests: $(objpfx)mtrace-tst-gettext do-translit-test
+$(objpfx)mtrace-tst-gettext: do-gettext-test
+	$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
 do-gettext-test: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
-	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
+	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \
+	  $(objpfx)tst-gettext.mtrace
  do-translit-test: $(objpfx)tst-translit.out
 $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
 	$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
@@ -76,27 +79,3 @@ YFLAGS = --name-prefix=__gettext --output
 
 $(inst_msgcatdir)/locale.alias: locale.alias $(+force)
 	$(do-install)
-
-ifdef gettext-srcdir
-
-%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.glibc; $(copysrc)
-%.c:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.c; $(copysrc)
-%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc)
-locale.alias:: ../gpl2lgpl.sed $(gettext-srcdir)/misc/locale.alias; $(copysrc)
-
-ifeq ($(with-cvs),yes)
-define copysrc
-sed -f $^ > $@.new
-chmod a-w $@.new
-mv -f $@.new $@
-test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $<' $@
-endef
-else
-define copysrc
-sed -f $^ > $@.new
-chmod a-w $@.new
-mv -f $@.new $@
-endef
-endif
-
-endif
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index da6d88a492..e431e4260f 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -1129,16 +1129,17 @@ mempcpy (dest, src, n)
 static void __attribute__ ((unused))
 free_mem (void)
 {
-  struct binding *runp;
   void *old;
 
-  for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
+  while (_nl_domain_bindings != NULL)
     {
-      if (runp->dirname != _nl_default_dirname)
+      struct binding *oldp = _nl_domain_bindings;
+      _nl_domain_bindings = _nl_domain_bindings->next;
+      if (oldp->dirname != _nl_default_dirname)
 	/* Yes, this is a pointer comparison.  */
-	free (runp->dirname);
-      if (runp->codeset != NULL)
-	free (runp->codeset);
+	free (oldp->dirname);
+      free (oldp->codeset);
+      free (oldp);
     }
 
   if (_nl_current_default_domain != _nl_default_default_domain)
@@ -1147,6 +1148,7 @@ free_mem (void)
 
   /* Remove the search tree with the known translations.  */
   __tdestroy (root, free);
+  root = NULL;
 
   while (transmem_list != NULL)
     {
diff --git a/intl/tst-gettext.c b/intl/tst-gettext.c
index 688acbf85a..cfd2d5fc53 100644
--- a/intl/tst-gettext.c
+++ b/intl/tst-gettext.c
@@ -19,6 +19,7 @@
 
 #include <libintl.h>
 #include <locale.h>
+#include <mcheck.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -55,6 +56,9 @@ main (int argc, char *argv[])
 {
   int result = 0;
 
+  /* For debugging.  */
+  mtrace ();
+
   /* This is the place where the .mo files are placed.  */
   if (argc > 1)
     {
diff --git a/intl/tst-gettext.sh b/intl/tst-gettext.sh
index 12094a7baf..42436fe5bf 100755
--- a/intl/tst-gettext.sh
+++ b/intl/tst-gettext.sh
@@ -20,6 +20,7 @@
 
 common_objpfx=$1
 objpfx=$2
+malloc_trace=$3
 
 GCONV_PATH=${common_objpfx}iconvdata
 export GCONV_PATH
@@ -42,6 +43,7 @@ msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \
        ../po/de.po
 
 # Now run the test.
+MALLOC_TRACE=$malloc_trace \
 ${common_objpfx}elf/ld.so --library-path $common_objpfx \
 ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir