Fix "use after free" on port creation error in r268291.