X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Ftgsi%2Ftgsi_parse.c;h=0081f74ffc491074f6cc7846943faec10af7e125;hb=0cce6d7e337ac3de515c48d6077c823c32e22613;hp=22006edf3d1d023f7705ec1093dbdaae62da8883;hpb=916de35d677ca5238e9515840fa5aa9f81302c5b;p=mesa.git diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 22006edf3d1..0081f74ffc4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -154,10 +154,17 @@ tgsi_parse_token( switch (imm->Immediate.DataType) { case TGSI_IMM_FLOAT32: - imm->u.Pointer = MALLOC( - sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.NrTokens - 1) ); - for( i = 0; i < imm->Immediate.NrTokens - 1; i++ ) { - next_token( ctx, (struct tgsi_immediate_float32 *) &imm->u.ImmediateFloat32[i] ); + { + uint imm_count = imm->Immediate.NrTokens - 1; + struct tgsi_immediate_float32 *data; + + data = (struct tgsi_immediate_float32 *) MALLOC(sizeof(struct tgsi_immediate_float32) * imm_count); + if (data) { + for (i = 0; i < imm_count; i++) { + next_token(ctx, &data[i]); + } + imm->u.ImmediateFloat32 = data; + } } break;