Add new and free

Both `sphia_new` and `sphia_free` are slightly modified versions of those in sphia(1).

I'm not entirely sure I've implemented the tests correctly. :/