Fix resource leak on error case. Coverity CID 1270068 and 1270060
Fix resource leak on error case.
Coverity CID 1270068 and 1270060

shekkbuilder/hwloc,shekkbuilder/hwloc,shekkbuilder/hwloc,shekkbuilder/hwloc