Add a missing but inconsequential free(3).

Spotted by:	Coverity
Add a testcase for #1406 to -trunk, which is not affected.
Tighten various asserts in the expiry code and close what could
conceiveably be a race that might be able to cause #1405.