Fixing a large number of programming errors found by static analysis

issues found by the coverity scanner, most are memory leaks on error
conditions.
Merge branch 'branch-6-4' into master-coverity

Conflicts:
	mapagg.cpp
	mapcontext.c
	mapdraw.c
	mapfile.c
	mapgd.c
	mapgml.c
	maplabel.c
	maplegend.c
	mapogcfilter.c
	mapoutput.c
	mappostgis.c
	maprendering.c
	mapwfs.c
	mapwfs11.c
	msautotest
fixups after coverity merge