Use SafeRelease and SafeDelete to make sure released objects are NULL and will cause proper errors if referenced again.

TRAC #23617

Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Author: Geoff Lang
diff --git a/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
index 5ffc232..899badd 100644
--- a/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
@@ -36,10 +36,7 @@
 {
     for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
     {
-        if (mVertexDeclCache[i].vertexDeclaration)
-        {
-            mVertexDeclCache[i].vertexDeclaration->Release();
-        }
+        SafeRelease(mVertexDeclCache[i].vertexDeclaration);
     }
 }
 
@@ -188,8 +185,7 @@
 
     if (lastCache->vertexDeclaration != NULL)
     {
-        lastCache->vertexDeclaration->Release();
-        lastCache->vertexDeclaration = NULL;
+        SafeRelease(lastCache->vertexDeclaration);
         // mLastSetVDecl is set to the replacement, so we don't have to worry
         // about it.
     }