bozo: Fix problems found by static analysis 76/14676/7
authorCheyenne Wills <cwills@sinenomine.net>
Tue, 31 Aug 2021 14:48:33 +0000 (08:48 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 1 Sep 2021 00:06:10 +0000 (20:06 -0400)
commit381597851b659f00747b22efc24240073c4403ce
treeadd0111ede7a93dff203b9e38adcd0f68ad3f473
parentf8dfa069cc371fbecc0fc9032f91a3b9e5618cb6
bozo: Fix problems found by static analysis

Several static analysis tools have identified various problems:
 - files left open from early exits/returns       (infer)
 - missing checks to ensure *alloc was successful (infer)
 - possible memory leaks                          (scan-build, cppcheck)

To resolve the above problems:
 - close files before exiting/returning
 - add checks to ensure *alloc was successful before using the memory
 - fix possible memory leaks by freeing memory

This commit is a reorganization of commits developed by Pat Riehecky,
who ran the static analysis tools and developed the fixes.

Change-Id: Iabebf46d2d1d8bb3bd2378cf2d1e7e4b94706bfd
Reviewed-on: https://gerrit.openafs.org/14676
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/bozo/bos.c
src/bozo/bosoprocs.c
src/bozo/bosserver.c