Fix gcc -Wunused-but-set-variable warning.
A set of trivial changes to support sanitizers on FreeBSD.

Patch by Viktor Kutuzov!