only free timer data when a free function provided

Signed-off-by: Jan Dvořák <mordae@anilinux.org>
properly track event handler

Libvirt does not track registered event handlers by their addresses,
but rather by some abstract IDs.  We need to store that ID and use it
when deregistering the handler.

Signed-off-by: Jan Dvořák <mordae@anilinux.org>