Fixes for Coverity-identified issues.

Signed-off-by: James Hunt <james.hunt@ubuntu.com>
Merge pull request #7 from jamesodhunt/coverity-fixes

Fixes for Coverity-identified issues.