Fix a leak in the local transport code.

This fixes the leak described in #1673.