summaryrefslogtreecommitdiff
path: root/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp')
-rw-r--r--src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp
index 3c90eae2840..e9231fc1b7d 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-shader.cpp
@@ -1270,8 +1270,13 @@ static bool dxbcByteWriterRealloc(DXBCByteWriter *w, uint32_t cbNew)
}
uint32_t const cbCurrent = dxbcByteWriterSize(w);
- memcpy(pvNew, w->pu8ByteCodeBegin, cbCurrent);
- RTMemFree(w->pu8ByteCodeBegin);
+ if (cbCurrent)
+ {
+ memcpy(pvNew, w->pu8ByteCodeBegin, cbCurrent);
+ RTMemFree(w->pu8ByteCodeBegin);
+ }
+ else
+ Assert(w->pu8ByteCodeBegin == NULL);
w->pu8ByteCodeBegin = (uint8_t *)pvNew;
w->pu8ByteCodePtr = w->pu8ByteCodeBegin + cbCurrent;