libc: atexit: reuse free slots at the end of exit functions table
libc: atexit: reuse free slots at the end of exit functions table

Continuosly dlopen and dlclose of shared object will cause a memory leak
in atexit function. This fix reuse free slots at the end of the list.

For further detail see https://bugs.busybox.net/show_bug.cgi?id=2455

Signed-off-by: Ronald Wahl <18bb69c7479970b0c0b6e387cbe7353a09282081@raritan.com>
Tested-by: Filippo Arcidiacono <26825f07340f791bc0d38da89fcffcd93550a83c@st.com>
Signed-off-by: Carmelo Amoroso <532378793705a04edd56deb76ad8c0442834d55d@st.com>

ffainelli/uClibc,majek/uclibc-vx32,foss-xtensa/uClibc,brgl/uclibc-ng,ffainelli/uClibc,brgl/uclibc-ng,foss-xtensa/uClibc,majek/uclibc-vx32,ffainelli/uClibc,ddcc/klee-uclibc-0.9.33.2,groundwater/uClibc,mephi42/uClibc,hjl-tools/uClibc,kraj/uclibc-ng,foss-xtensa/uClibc,mephi42/uClibc,majek/uclibc-vx32,wbx-github/uclibc-ng,wbx-github/uclibc-ng,kraj/uclibc-ng,kraj/uClibc,mephi42/uClibc,hjl-tools/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,hwoarang/uClibc,ddcc/klee-uclibc-0.9.33.2,ddcc/klee-uclibc-0.9.33.2,foss-xtensa/uClibc,kraj/uclibc-ng,waweber/uclibc-clang,majek/uclibc-vx32,hwoarang/uClibc,groundwater/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,ffainelli/uClibc,mephi42/uClibc,groundwater/uClibc,waweber/uclibc-clang,brgl/uclibc-ng,groundwater/uClibc,hjl-tools/uClibc,ddcc/klee-uclibc-0.9.33.2,hjl-tools/uClibc,wbx-github/uclibc-ng,hwoarang/uClibc,kraj/uClibc,groundwater/uClibc,kraj/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,kraj/uclibc-ng,ffainelli/uClibc,brgl/uclibc-ng,hjl-tools/uClibc,waweber/uclibc-clang,waweber/uclibc-clang,wbx-github/uclibc-ng,kraj/uClibc,hwoarang/uClibc