Set OSREL and UNAME_r in release/release.sh when building
ports to prevent ports build failures from killing the
release build.

MFC after:	3 days
X-MFC-with:	r270417, r270418
Sponsored by:	The FreeBSD Foundation
Plug a memory leak in case of failed lookups in capability mode.

Put common cnp cleanup into one function and use it for this purpose.

MFC after:	1 week
Wrap a long line.

MFC after:	3 days
X-MFC-with:	r270417, r270418, r270455
Sponsored by:	The FreeBSD Foundation