More fixes for static analysis issues. Further observations from Zoltan Fridrich's static analysis of libcap. This commit also includes a fix for something I broke with the last round of "fixing", and a test to make sure I don't make that mistake again. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>