[Mesa-dev] [PATCH 36/71] st/nine: Fix use of uninitialized values
Axel Davy
axel.davy at ens.fr
Sun Aug 16 08:28:00 PDT 2015
From: Patrick Rudolph <siro at das-labor.org>
Set all values to 0 after allocation. Found using valgrind.
Reviewed-by: Axel Davy <axel.davy at ens.fr>
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
src/gallium/state_trackers/nine/device9.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 96d27e1..e0f3e39 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2138,8 +2138,10 @@ NineDevice9_SetLight( struct NineDevice9 *This,
return E_OUTOFMEMORY;
state->ff.num_lights = N;
- for (; n < Index; ++n)
+ for (; n < Index; ++n) {
+ memset(&state->ff.light[n], 0, sizeof(D3DLIGHT9));
state->ff.light[n].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
+ }
}
state->ff.light[Index] = *pLight;
--
2.1.0
More information about the mesa-dev
mailing list