Merged latest changes from cmake development branch.

Addressed a number of memory-related problems
reported by Coverity.




git-svn-id: https://sub.unidata.ucar.edu/netcdf/trunk@3123 2e3060e4-1ed8-cf1f-9cc2-9586e844a556