don't free xkb_layout or xkb_variant when it has not been set
call time instead of gmtime (makes valgrind happy)
Merge pull request #902 from hardening/hardening7

Corrections found by Valgrind