Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 54782)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 54783)
@@ -2627,6 +2627,7 @@
     if (sid >= pState->cSurfaces)
     {
-        pState->paSurface = (PVMSVGA3DSURFACE )RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
-        AssertReturn(pState->paSurface, VERR_NO_MEMORY);
+        void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
+        AssertReturn(pvNew, VERR_NO_MEMORY);
+        pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
         memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
         for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
@@ -4238,6 +4239,7 @@
         if (cid >= pState->cContexts)
         {
-            pState->paContext = (PVMSVGA3DCONTEXT)RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
-            AssertReturn(pState->paContext, VERR_NO_MEMORY);
+            void *pvNew = RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
+            AssertReturn(pvNew, VERR_NO_MEMORY);
+            pState->paContext = (PVMSVGA3DCONTEXT)pvNew;
             memset(&pState->paContext[pState->cContexts], 0, sizeof(VMSVGA3DCONTEXT) * (cid + 1 - pState->cContexts));
             for (uint32_t i = pState->cContexts; i < cid + 1; i++)
@@ -7429,6 +7431,7 @@
         if (shid >= pContext->cVertexShaders)
         {
-            pContext->paVertexShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
-            AssertReturn(pContext->paVertexShader, VERR_NO_MEMORY);
+            void *pvNew = RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1))
+            AssertReturn(pvNew, VERR_NO_MEMORY);
+            pContext->paVertexShader = (PVMSVGA3DSHADER)pvNew;
             memset(&pContext->paVertexShader[pContext->cVertexShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cVertexShaders));
             for (uint32_t i = pContext->cVertexShaders; i < shid + 1; i++)
@@ -7447,6 +7450,7 @@
         if (shid >= pContext->cPixelShaders)
         {
-            pContext->paPixelShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
-            AssertReturn(pContext->paPixelShader, VERR_NO_MEMORY);
+            void *pvNew = RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
+            AssertReturn(pvNew, VERR_NO_MEMORY);
+            pContext->paPixelShader = (PVMSVGA3DSHADER)pvNew;
             memset(&pContext->paPixelShader[pContext->cPixelShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cPixelShaders));
             for (uint32_t i = pContext->cPixelShaders; i < shid + 1; i++)
Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 54782)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp	(revision 54783)
@@ -1398,6 +1398,7 @@
     if (sid >= pState->cSurfaces)
     {
-        pState->paSurface = (PVMSVGA3DSURFACE )RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
-        AssertReturn(pState->paSurface, VERR_NO_MEMORY);
+        void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
+        AssertReturn(pvNew, VERR_NO_MEMORY);
+        pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
         memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
         for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
@@ -1633,5 +1634,7 @@
         Assert(pSurface->pSharedObjectTree == NULL);
 
-        switch (pSurface->flags & (SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER | SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP))
+        switch (pSurface->flags & (  SVGA3D_SURFACE_HINT_INDEXBUFFER  | SVGA3D_SURFACE_HINT_VERTEXBUFFER
+                                   | SVGA3D_SURFACE_HINT_TEXTURE      | SVGA3D_SURFACE_HINT_RENDERTARGET
+                                   | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP))
         {
         case SVGA3D_SURFACE_CUBEMAP:
@@ -2921,6 +2924,7 @@
     if (cid >= pState->cContexts)
     {
-        pState->paContext = (PVMSVGA3DCONTEXT)RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
-        AssertReturn(pState->paContext, VERR_NO_MEMORY);
+        void *pvNew = RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
+        AssertReturn(pvNew, VERR_NO_MEMORY);
+        pState->paContext = (PVMSVGA3DCONTEXT)pvNew;
         memset(&pState->paContext[pState->cContexts], 0, sizeof(VMSVGA3DCONTEXT) * (cid + 1 - pState->cContexts));
         for (uint32_t i = pState->cContexts; i < cid + 1; i++)
@@ -5720,6 +5724,7 @@
         if (shid >= pContext->cVertexShaders)
         {
-            pContext->paVertexShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
-            AssertReturn(pContext->paVertexShader, VERR_NO_MEMORY);
+            void *pvNew = RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
+            AssertReturn(pvNew, VERR_NO_MEMORY);
+            pContext->paVertexShader = (PVMSVGA3DSHADER)pvNew;
             memset(&pContext->paVertexShader[pContext->cVertexShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cVertexShaders));
             for (uint32_t i = pContext->cVertexShaders; i < shid + 1; i++)
@@ -5738,6 +5743,7 @@
         if (shid >= pContext->cPixelShaders)
         {
-            pContext->paPixelShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
-            AssertReturn(pContext->paPixelShader, VERR_NO_MEMORY);
+            void *pvNew = RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
+            AssertReturn(pvNew, VERR_NO_MEMORY);
+            pContext->paPixelShader = (PVMSVGA3DSHADER)pvNew;
             memset(&pContext->paPixelShader[pContext->cPixelShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cPixelShaders));
             for (uint32_t i = pContext->cPixelShaders; i < shid + 1; i++)
