Fix defects found by static analyzers

Closes #193.

Signed-off-by: Martin Milata <mmilata@redhat.com>