Fix crash in bytea-to-XML mapping when the source value is toasted. Report and fix by Michael McMaster.  Some minor code beautification by me, also avoid memory leaks in the special-case paths.
Fix crash in bytea-to-XML mapping when the source value is toasted.
Report and fix by Michael McMaster.  Some minor code beautification by me,
also avoid memory leaks in the special-case paths.

zaksoup/gpdb,lisakowen/gpdb,janebeckman/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,royc1/gpdb,50wu/gpdb,CraigHarris/gpdb,zaksoup/gpdb,janebeckman/gpdb,lisakowen/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,edespino/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,xinzweb/gpdb,lintzc/gpdb,cjcjameson/gpdb,Quikling/gpdb,rvs/gpdb,lintzc/gpdb,janebeckman/gpdb,Chibin/gpdb,Chibin/gpdb,adam8157/gpdb,lisakowen/gpdb,Quikling/gpdb,0x0FFF/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,rvs/gpdb,xuegang/gpdb,lisakowen/gpdb,chrishajas/gpdb,janebeckman/gpdb,edespino/gpdb,50wu/gpdb,xinzweb/gpdb,rvs/gpdb,Quikling/gpdb,chrishajas/gpdb,chrishajas/gpdb,edespino/gpdb,lintzc/gpdb,lisakowen/gpdb,Quikling/gpdb,adam8157/gpdb,Chibin/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,rvs/gpdb,zaksoup/gpdb,xinzweb/gpdb,0x0FFF/gpdb,50wu/gpdb,rvs/gpdb,xinzweb/gpdb,rvs/gpdb,zaksoup/gpdb,ahachete/gpdb,cjcjameson/gpdb,0x0FFF/gpdb,ahachete/gpdb,rvs/gpdb,kaknikhil/gpdb,zaksoup/gpdb,ahachete/gpdb,kaknikhil/gpdb,50wu/gpdb,edespino/gpdb,royc1/gpdb,xinzweb/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,cjcjameson/gpdb,Quikling/gpdb,chrishajas/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,ahachete/gpdb,lintzc/gpdb,Chibin/gpdb,50wu/gpdb,greenplum-db/gpdb,Quikling/gpdb,rvs/gpdb,CraigHarris/gpdb,chrishajas/gpdb,edespino/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,xuegang/gpdb,zaksoup/gpdb,0x0FFF/gpdb,greenplum-db/gpdb,0x0FFF/gpdb,kaknikhil/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,chrishajas/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,ahachete/gpdb,ahachete/gpdb,royc1/gpdb,edespino/gpdb,jmcatamney/gpdb,edespino/gpdb,0x0FFF/gpdb,xuegang/gpdb,xuegang/gpdb,edespino/gpdb,lintzc/gpdb,50wu/gpdb,xinzweb/gpdb,janebeckman/gpdb,jmcatamney/gpdb,lisakowen/gpdb,yuanzhao/gpdb,royc1/gpdb,yuanzhao/gpdb,janebeckman/gpdb,adam8157/gpdb,xuegang/gpdb,jmcatamney/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,xuegang/gpdb,cjcjameson/gpdb,50wu/gpdb,royc1/gpdb,Chibin/gpdb,lisakowen/gpdb,Chibin/gpdb,edespino/gpdb,0x0FFF/gpdb,lintzc/gpdb,yuanzhao/gpdb,lintzc/gpdb,CraigHarris/gpdb,adam8157/gpdb,xuegang/gpdb,ashwinstar/gpdb,xuegang/gpdb,Quikling/gpdb,chrishajas/gpdb,lintzc/gpdb,ashwinstar/gpdb,ahachete/gpdb,xinzweb/gpdb,royc1/gpdb,Quikling/gpdb,CraigHarris/gpdb,xinzweb/gpdb,janebeckman/gpdb,rvs/gpdb,adam8157/gpdb,Chibin/gpdb,Quikling/gpdb,chrishajas/gpdb,lisakowen/gpdb,ashwinstar/gpdb,janebeckman/gpdb,lintzc/gpdb,rvs/gpdb,jmcatamney/gpdb,edespino/gpdb,greenplum-db/gpdb,zaksoup/gpdb,Chibin/gpdb,jmcatamney/gpdb,adam8157/gpdb,kaknikhil/gpdb,xuegang/gpdb,zaksoup/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,royc1/gpdb,Chibin/gpdb,greenplum-db/gpdb,Chibin/gpdb,royc1/gpdb,adam8157/gpdb,ahachete/gpdb,janebeckman/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,adam8157/gpdb,janebeckman/gpdb,ashwinstar/gpdb,Quikling/gpdb,yuanzhao/gpdb