Fix several nits in redirection handling - don't use wrong CSG,
and avoid use-after-free.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation