destroy cfg resources in error paths