Commit 10b54a78 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Initialize the surface desc's dwFlags field to 0 before surface locks.

Otherwise DDSD2_to_DDSD() would try to convert uninitialized data on failure. Spotted by Dan Kegel / Valgrind.
parent 6b0f110f
...@@ -969,6 +969,7 @@ static HRESULT WINAPI ddraw_surface3_Lock(IDirectDrawSurface3 *iface, RECT *rect ...@@ -969,6 +969,7 @@ static HRESULT WINAPI ddraw_surface3_Lock(IDirectDrawSurface3 *iface, RECT *rect
} }
surface_desc2.dwSize = surface_desc->dwSize; surface_desc2.dwSize = surface_desc->dwSize;
surface_desc2.dwFlags = 0;
hr = surface_lock(This, rect, &surface_desc2, flags, h); hr = surface_lock(This, rect, &surface_desc2, flags, h);
DDSD2_to_DDSD(&surface_desc2, surface_desc); DDSD2_to_DDSD(&surface_desc2, surface_desc);
surface_desc->dwSize = surface_desc2.dwSize; surface_desc->dwSize = surface_desc2.dwSize;
...@@ -993,6 +994,7 @@ static HRESULT WINAPI ddraw_surface2_Lock(IDirectDrawSurface2 *iface, RECT *rect ...@@ -993,6 +994,7 @@ static HRESULT WINAPI ddraw_surface2_Lock(IDirectDrawSurface2 *iface, RECT *rect
} }
surface_desc2.dwSize = surface_desc->dwSize; surface_desc2.dwSize = surface_desc->dwSize;
surface_desc2.dwFlags = 0;
hr = surface_lock(This, rect, &surface_desc2, flags, h); hr = surface_lock(This, rect, &surface_desc2, flags, h);
DDSD2_to_DDSD(&surface_desc2, surface_desc); DDSD2_to_DDSD(&surface_desc2, surface_desc);
surface_desc->dwSize = surface_desc2.dwSize; surface_desc->dwSize = surface_desc2.dwSize;
...@@ -1017,6 +1019,7 @@ static HRESULT WINAPI ddraw_surface1_Lock(IDirectDrawSurface *iface, RECT *rect, ...@@ -1017,6 +1019,7 @@ static HRESULT WINAPI ddraw_surface1_Lock(IDirectDrawSurface *iface, RECT *rect,
} }
surface_desc2.dwSize = surface_desc->dwSize; surface_desc2.dwSize = surface_desc->dwSize;
surface_desc2.dwFlags = 0;
hr = surface_lock(This, rect, &surface_desc2, flags, h); hr = surface_lock(This, rect, &surface_desc2, flags, h);
DDSD2_to_DDSD(&surface_desc2, surface_desc); DDSD2_to_DDSD(&surface_desc2, surface_desc);
surface_desc->dwSize = surface_desc2.dwSize; surface_desc->dwSize = surface_desc2.dwSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment