datastore: add leaf list functionality

Also fixes ds_free_key bug

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