Again, this can be reproduced with only Valgrind and Bash installed, by copy/pasting the following command:
echo "#! /bin/bashecho 'Am I leaking?'" > leak.sh \&& chmod +x leak.sh \&& LC_ALL=C valgrind -v --leak-check=full /bin/bash leak.sh This is the best log I know how to generate using Valgrind without first understanding the composition or architecture of the underlying program (i.e. `bash`). Here is the log from my machine: $ LC_ALL=C valgrind -v --leak-check=full /bin/bash leak.sh==53602== Memcheck, a memory error detector==53602== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.==53602== Using Valgrind-3.16.1-36d6727e1d-20200622X and LibVEX; rerun with -h for copyright info==53602== Command: /bin/bash leak.sh==53602== --53602-- Valgrind options:--53602-- -v--53602-- --leak-check=full--53602-- Contents of /proc/version:--53602-- Linux version 5.11.0-7614-generic (buildd@lgw01-amd64-047) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #15~1622578982~20.10~383c0a9-Ubuntu SMP Wed Jun 2 00:54:41 UTC 2--53602-- --53602-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand--53602-- Page sizes: currently 4096, max supported 4096--53602-- Valgrind library directory: /usr/lib/x86_64-linux-gnu/valgrind--53602-- Reading syms from /usr/bin/bash--53602-- object doesn't have a symbol table--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/ld-2.32.so--53602-- Considering /usr/lib/x86_64-linux-gnu/ld-2.32.so ..--53602-- .. CRC mismatch (computed 26410511 wanted 6010827e)--53602-- Considering /lib/x86_64-linux-gnu/ld-2.32.so ..--53602-- .. CRC mismatch (computed 26410511 wanted 6010827e)--53602-- Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.32.so ..--53602-- .. CRC is valid--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/memcheck-amd64-linux--53602-- object doesn't have a symbol table--53602-- object doesn't have a dynamic symbol table--53602-- Scheduler: using generic scheduler lock implementation.--53602-- Reading suppressions file: /usr/lib/x86_64-linux-gnu/valgrind/default.supp==53602== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-53602-by-zak-on-???==53602== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-53602-by-zak-on-???==53602== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-53602-by-zak-on-???==53602== ==53602== TO CONTROL THIS PROCESS USING vgdb (which you probably==53602== don't want to do, unless you know exactly what you're doing,==53602== or are doing some strange experiment):==53602== /usr/bin/vgdb --pid=53602 ...command...==53602== ==53602== TO DEBUG THIS PROCESS USING GDB: start GDB like this==53602== /path/to/gdb /bin/bash==53602== and then give GDB the following command==53602== target remote | /usr/bin/vgdb --pid=53602==53602== --pid is optional if only one valgrind process is running==53602== --53602-- REDIR: 0x4023b00 (ld-linux-x86-64.so.2:strlen) redirected to 0x580ccb72 (???)--53602-- REDIR: 0x40238d0 (ld-linux-x86-64.so.2:index) redirected to 0x580ccb8c (???)--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_core-amd64-linux.so--53602-- object doesn't have a symbol table--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so--53602-- object doesn't have a symbol table==53602== WARNING: new redirection conflicts with existing -- ignoring it--53602-- old: 0x04023b00 (strlen ) R-> (0000.0) 0x580ccb72 ???--53602-- new: 0x04023b00 (strlen ) R-> (2007.0) 0x04840060 strlen--53602-- REDIR: 0x40202e0 (ld-linux-x86-64.so.2:strcmp) redirected to 0x4840fd0 (strcmp)--53602-- REDIR: 0x4024060 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x4844af0 (mempcpy)--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/libtinfo.so.6.2--53602-- object doesn't have a symbol table--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/libdl-2.32.so--53602-- Considering /usr/lib/x86_64-linux-gnu/libdl-2.32.so ..--53602-- .. CRC mismatch (computed 0592691b wanted e69b33c5)--53602-- Considering /lib/x86_64-linux-gnu/libdl-2.32.so ..--53602-- .. CRC mismatch (computed 0592691b wanted e69b33c5)--53602-- Considering /usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.32.so ..--53602-- .. CRC is valid--53602-- Reading syms from /usr/lib/x86_64-linux-gnu/libc-2.32.so--53602-- Considering /usr/lib/x86_64-linux-gnu/libc-2.32.so ..--53602-- .. CRC mismatch (computed 2798f119 wanted a3907336)--53602-- Considering /lib/x86_64-linux-gnu/libc-2.32.so ..--53602-- .. CRC mismatch (computed 2798f119 wanted a3907336)--53602-- Considering /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.32.so ..--53602-- .. CRC is valid--53602-- REDIR: 0x49381f0 (libc.so.6:memmove) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937680 (libc.so.6:strncpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938530 (libc.so.6:strcasecmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937120 (libc.so.6:strcat) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49376e0 (libc.so.6:rindex) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49399f0 (libc.so.6:rawmemchr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4954150 (libc.so.6:wmemchr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4953c90 (libc.so.6:wcscmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938350 (libc.so.6:mempcpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938180 (libc.so.6:bcmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937610 (libc.so.6:strncmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49371d0 (libc.so.6:strcmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49382c0 (libc.so.6:memset) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4953c50 (libc.so.6:wcschr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937570 (libc.so.6:strnlen) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49372b0 (libc.so.6:strcspn) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938580 (libc.so.6:strncasecmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937250 (libc.so.6:strcpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49386d0 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49553d0 (libc.so.6:wcsnlen) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4953cd0 (libc.so.6:wcscpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937720 (libc.so.6:strpbrk) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937180 (libc.so.6:index) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937530 (libc.so.6:strlen) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x493fee0 (libc.so.6:memrchr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49385d0 (libc.so.6:strcasecmp_l) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938140 (libc.so.6:memchr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4953da0 (libc.so.6:wcslen) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4937850 (libc.so.6:strspn) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49384d0 (libc.so.6:stpncpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938470 (libc.so.6:stpcpy) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4939a30 (libc.so.6:strchrnul) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938620 (libc.so.6:strncasecmp_l) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49375b0 (libc.so.6:strncat) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49c2500 (libc.so.6:__memcpy_chk) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4938060 (libc.so.6:strstr) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x49c25d0 (libc.so.6:__memmove_chk) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)==53602== WARNING: new redirection conflicts with existing -- ignoring it--53602-- old: 0x04a20170 (__memcpy_chk_avx_una) R-> (2030.0) 0x04844be0 __memcpy_chk--53602-- new: 0x04a20170 (__memcpy_chk_avx_una) R-> (2024.0) 0x048445a0 __memmove_chk--53602-- REDIR: 0x4953e40 (libc.so.6:wcsncmp) redirected to 0x48321d0 (_vgnU_ifunc_wrapper)--53602-- REDIR: 0x4a1cfa0 (libc.so.6:__strrchr_avx2) redirected to 0x483fa10 (rindex)--53602-- REDIR: 0x4a18660 (libc.so.6:__strcmp_avx2) redirected to 0x4840ed0 (strcmp)--53602-- REDIR: 0x4a1d170 (libc.so.6:__strlen_avx2) redirected to 0x483ff40 (strlen)--53602-- REDIR: 0x4a18aa0 (libc.so.6:__strncmp_avx2) redirected to 0x4840670 (strncmp)--53602-- REDIR: 0x4a1cb80 (libc.so.6:__strchr_avx2) redirected to 0x483fbf0 (index)--53602-- REDIR: 0x4932b70 (libc.so.6:free) redirected to 0x483d9d0 (free)--53602-- REDIR: 0x4932560 (libc.so.6:malloc) redirected to 0x483c780 (malloc)--53602-- REDIR: 0x4a1e6b0 (libc.so.6:__strcpy_avx2) redirected to 0x4840090 (strcpy)--53602-- REDIR: 0x4a20180 (libc.so.6:__memcpy_avx_unaligned_erms) redirected to 0x4843ac0 (memmove)--53602-- REDIR: 0x4a1d310 (libc.so.6:__strnlen_avx2) redirected to 0x483fee0 (strnlen)--53602-- REDIR: 0x4a1cdb0 (libc.so.6:__strchrnul_avx2) redirected to 0x4844610 (strchrnul)--53602-- REDIR: 0x49c28d0 (libc.so.6:__strcpy_chk) redirected to 0x4844690 (__strcpy_chk)--53602-- REDIR: 0x4932f20 (libc.so.6:realloc) redirected to 0x483ef30 (realloc)--53602-- REDIR: 0x4a20600 (libc.so.6:__memset_avx2_unaligned_erms) redirected to 0x48439b0 (memset)Am I leaking?==53602== ==53602== HEAP SUMMARY:==53602== in use at exit: 43,186 bytes in 634 blocks==53602== total heap usage: 668 allocs, 34 frees, 46,360 bytes allocated==53602== ==53602== Searching for pointers to 634 not-freed blocks==53602== Checked 190,472 bytes==53602== ==53602== 2 bytes in 1 blocks are definitely lost in loss record 10 of 264==53602== at 0x483C7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)==53602== by 0x198523: xmalloc (in /usr/bin/bash)==53602== by 0x19199E: set_default_locale (in /usr/bin/bash)==53602== by 0x136C8A: main (in /usr/bin/bash)==53602== ==53602== LEAK SUMMARY:==53602== definitely lost: 2 bytes in 1 blocks==53602== indirectly lost: 0 bytes in 0 blocks==53602== possibly lost: 0 bytes in 0 blocks==53602== still reachable: 43,184 bytes in 633 blocks==53602== suppressed: 0 bytes in 0 blocks==53602== Reachable blocks (those to which a pointer was found) are not shown.==53602== To see them, rerun with: --leak-check=full --show-leak-kinds=all==53602== ==53602== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) On Tuesday, June 15, 2021, 08:16:02 AM CDT, Chet Ramey <chet.ra...@case.edu> wrote: On 6/12/21 12:16 PM, Zachary Fields via Bug reports for the GNU Bourne Again SHell wrote: > LEAK SUMMARY: ==1365336== definitely lost: 12 bytes in 1 blocks > ==1365336== How about more details fromn valgrind about where it thinks the leak is? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/