mesa/st+tgsi: Provide a free callback to match with ureg_get_tokens().

This fixes crashes with the memory debugging routines on Windows.

NOTE: This is a candidate for the 7.8 stable branch
This commit is contained in:
José Fonseca 2010-05-11 21:27:05 +01:00
parent 48f8a76549
commit edbc302ad6
3 changed files with 12 additions and 2 deletions

View file

@ -1467,6 +1467,12 @@ const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
}
void ureg_free_tokens( const struct tgsi_token *tokens )
{
FREE((struct tgsi_token *)tokens);
}
struct ureg_program *ureg_create( unsigned processor )
{
struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );

View file

@ -104,6 +104,10 @@ ureg_get_tokens( struct ureg_program *ureg,
unsigned *nr_tokens );
/* Free the tokens created by ureg_get_tokens() */
void ureg_free_tokens( const struct tgsi_token *tokens );
void
ureg_destroy( struct ureg_program * );

View file

@ -1140,7 +1140,7 @@ st_destroy_drawpix(struct st_context *st)
st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
if (st->drawpix.vert_shaders[0])
free(st->drawpix.vert_shaders[0]);
ureg_free_tokens(st->drawpix.vert_shaders[0]);
if (st->drawpix.vert_shaders[1])
free(st->drawpix.vert_shaders[1]);
ureg_free_tokens(st->drawpix.vert_shaders[1]);
}