mesa: fix potential uninitialized memory reads
[mesa.git] / src / mesa / main / rastpos.c
index 155140f3cccfbae7026600fbc51f81798b692cf9..9f309d6ab846679aafc51e97d10bc89c6eec2a73 100644 (file)
@@ -50,12 +50,12 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
    p[2] = z;
    p[3] = w;
 
-   if (ctx->NewState)
-      _mesa_update_state( ctx );
-
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
    FLUSH_CURRENT(ctx, 0);
 
+   if (ctx->NewState)
+      _mesa_update_state( ctx );
+
    ctx->Driver.RasterPos(ctx, p);
 }
 
@@ -500,7 +500,7 @@ void _mesa_init_rastpos( GLcontext * ctx )
    ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 );
    ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 );
    ctx->Current.RasterIndex = 1.0;
-   for (i=0; i<MAX_TEXTURE_UNITS; i++)
+   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++)
       ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 );
    ctx->Current.RasterPosValid = GL_TRUE;
 }