]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: consistently free hash structures in dev mode
authorPádraig Brady <P@draigBrady.com>
Mon, 3 May 2021 17:11:04 +0000 (18:11 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 8 May 2021 13:57:33 +0000 (14:57 +0100)
commit09bbb2b703d78e2d577cba57b8bb3ad339303835
tree9728cb34142fe7afcdccb7f8204cbd49b47ede14
parent65e4d0f71e3df711cf604209e148a051cd71580f
maint: consistently free hash structures in dev mode

Ensure we call hash_free() to avoid valgrind and leak_sanitizer
"definitely lost" warnings.  These were not real leaks as
we terminate immediately after, but we should avoid these
"definitely lost" warnings where possible.

* src/copy.c: Add dest_info_free() and src_info_free().
* src/copy.h: Declare the above.
* src/cp-hash.c: Don't define unless "lint" is defined.
* src/install.c: Call dest_info_free() in dev mode.
* src/mv.c: Likewise.
* src/cp.c: Likewise. Also call src_info_free().
* src/ln.c: Call hash_free() in dev mode.
* src/tail.c: Call hash_free() even if about to exit, in dev mode.

Fixes https://bugs.gnu.org/48189
src/copy.c
src/copy.h
src/cp-hash.c
src/cp.c
src/install.c
src/ln.c
src/mv.c
src/tail.c