st/nine: Fix use of uninitialized values
authorPatrick Rudolph <siro@das-labor.org>
Sun, 17 May 2015 10:46:42 +0000 (12:46 +0200)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:46 +0000 (22:21 +0200)
Set all values to 0 after allocation. Found using valgrind.

Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
src/gallium/state_trackers/nine/device9.c

index 96d27e185b266c22f4caa4b07dc265b356a9b1ea..e0f3e398ad7c5e203e9d629deb285d08878cd499 100644 (file)
@@ -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;