Fix memory leak in Irmin_mem