discover: Release process resources on error