Fix for Coverity defect 14006: RESOURCE_LEAK