Found by running the test suite under ASAN. ================================================================= ==3298==ERROR: LeakSanitizer: detected memory leaks Direct leak of 12 byte(s) in 1 object(s) allocated from: #0 0x7f2b94db1d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28) #1 0x558589eb06d6 in xmalloc (/home/dualbus/src/gnu/bash-build/bash+0x14f6d6) #2 0x558589ea2c62 in set_default_locale (/home/dualbus/src/gnu/bash-build/bash+0x141c62) #3 0x558589de17f0 in main (/home/dualbus/src/gnu/bash-build/bash+0x807f0) #4 0x7f2b945442b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0) SUMMARY: AddressSanitizer: 12 byte(s) leaked in 1 allocation(s).
*** /tmp/R6GbnO_locale.c 2017-06-07 20:40:25.575118629 -0500 --- locale.c 2017-06-07 20:39:59.054419575 -0500 *************** *** 85,91 **** textdomain (PACKAGE); locale_mb_cur_max = MB_CUR_MAX; ! locale_utf8locale = locale_isutf8 (default_locale); locale_shiftstates = mblen ((char *)NULL, 0); } --- 85,98 ---- textdomain (PACKAGE); locale_mb_cur_max = MB_CUR_MAX; ! locale_utf8locale = 0; ! #if defined (HAVE_SETLOCALE) ! if (default_locale) ! { ! locale_utf8locale = locale_isutf8 (default_locale); ! free (default_locale); ! } ! #endif /* HAVE_SETLOCALE */ locale_shiftstates = mblen ((char *)NULL, 0); } -- Eduardo Bustamante https://dualbus.me/