Fixed coverity defects, two missing checks for error condition and resource leak.
Fixed coverity defects, two missing checks for error condition and resource leak.

tomasthoresen/osg,marchelbling/osg,jtorresfabra/osg,openscenegraph/osg,tomasthoresen/osg,scrawl/osg,marchelbling/osg,openscenegraph/osg,marchelbling/osg,scrawl/osg,tomasthoresen/osg,scrawl/osg,jtorresfabra/osg,scrawl/osg,openscenegraph/osg,jtorresfabra/osg,jtorresfabra/osg,openscenegraph/osg,tomasthoresen/osg,marchelbling/osg