This is check is a bit too eager. The user should be able to handle the return value even if it's a freed object.