Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)

I get above error when i add this code:

    void OnDestroy()
    {
        //get "Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)" error message
        Destroy(renderer.material);
    }

According to link text, i have to do this?

Calling renderer.material creates a new instance of that material. In the docs it states

Note:
This function automatically instantiates the materials and makes them unique to this renderer...

If you want to access the material without instantiating use renderer.sharedMaterial.