New block transfer protocol.
Fix a few memory leaks.