]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: avoid warnings from GCC's -fanalyzer
authorPádraig Brady <P@draigBrady.com>
Sun, 10 May 2020 13:22:06 +0000 (14:22 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 11 May 2020 20:18:47 +0000 (21:18 +0100)
commitc7194b43fca6f58e66435e4d089e5a9ea15673ab
tree1dd1e7c424dd0120f330718245fd16f43f55903d
parent9c8a385aa4c342a2b1af5f5a0604afb249a1cf66
maint: avoid warnings from GCC's -fanalyzer

* src/env.c (build_argv): Add an assert() to avoid:
  warning: use of NULL 'n' where non-null expected
  [CWE-690] [-Wanalyzer-null-argument]
  note: argument 1 of 'getenv' must be non-null
* src/dd.c (alloc_ibuf): Don't discard the allocated pointer, to avoid:
  [CWE-401] [-Wanalyzer-malloc-leak]
(alloc_obuf): Likewise.
(cleanup): Deallocate the now tracked buffers which
also avoids "possibly lost" warnings from valgrind.
* src/tsort.c (search_item): Add asserts to avoid:
  [CWE-690] [-Wanalyzer-null-dereference]
(record_relation): An assert doesn't suffice here,
so disable the warning for this function.
* src/comm.c: Suppress the following false positive for the whole file:
  [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
* src/chown-core.c: Suppress the following false positive for the file:
  [CWE-415] [-Wanalyzer-double-free]
src/chown-core.c
src/comm.c
src/dd.c
src/env.c
src/tsort.c