resources: when allocate_resource() fails, leave resource untouched