datastore: fix getting key from xml and freeing it

Signed-off-by: Zvonimir Fras <zvonimir.fras@sartura.hr>