add missing return check if a hook failed to allocate
check returns of allocation and cleanup