Got allocation and freeing working. Nasty bug was forgetting to open disk for r/w.