[No reviewer] Fix memory issues around AsChainLink lifetime and reinstate disabled test

Fixed the final memory issue that resulted in a leaking AsChain object.  This seems to also have fixed the problem with the new test case, so I've reenabled that as well.