Call libc and libstdc++ freeres functions in heaptrack_preload on exit
These functions are used by Valgrind already and can be used to force
a clean shutdown of libc and libstdc++. Both usually don't bother
freeing their global resources, which used to be reported as memory
leaks by heaptrack. By calling the freeres functions we now get a
clean shutdown of the libc_leaks.c example without any memory leaks
reported.
Thanks to Maxim Golov for pointing out this hidden functionality and
providing a test case.
BUG: 378765