i965: Fix several memory leaks on exit.

Bug #25194.
This commit is contained in:
Eric Anholt 2009-11-21 13:33:21 +01:00
parent 052b127842
commit 8451b29d96
4 changed files with 11 additions and 5 deletions

View file

@ -112,6 +112,7 @@ void brw_validate_state(struct brw_context *brw);
void brw_upload_state(struct brw_context *brw);
void brw_init_state(struct brw_context *brw);
void brw_destroy_state(struct brw_context *brw);
void brw_clear_validated_bos(struct brw_context *brw);
/***********************************************************************
* brw_state_cache.c

View file

@ -143,7 +143,7 @@ static void xor_states( struct brw_state_flags *result,
result->cache = a->cache ^ b->cache;
}
static void
void
brw_clear_validated_bos(struct brw_context *brw)
{
int i;

View file

@ -46,7 +46,7 @@
#include "brw_state.h"
#include "brw_fallback.h"
#include "brw_vs.h"
#include "brw_wm.h"
static void
dri_bo_release(dri_bo **bo)
@ -66,8 +66,14 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
_mesa_free(brw->wm.compile_data);
brw_clear_validated_bos(brw);
if (brw->wm.compile_data) {
_mesa_free(brw->wm.compile_data->instruction);
_mesa_free(brw->wm.compile_data->vreg);
_mesa_free(brw->wm.compile_data->refs);
_mesa_free(brw->wm.compile_data->prog_instructions);
_mesa_free(brw->wm.compile_data);
}
for (i = 0; i < brw->state.nr_color_regions; i++)
intel_region_release(&brw->state.color_regions[i]);

View file

@ -157,7 +157,6 @@ static void do_wm_prog( struct brw_context *brw,
sizeof(*c->prog_instructions));
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
} else {
void *instruction = c->instruction;
void *prog_instructions = c->prog_instructions;