Check for NULL with wrapper around free

Use a wrapper function for calls to free(), and let it check for NULL.
This makes it unnecessary to explicitly check for NULL before calling
and the extra indentation step that entails.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>