From: Zou Nan hai Date: Tue, 18 Sep 2007 03:32:25 +0000 (+0800) Subject: fix double free in 965-glsl branch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25bda451bbdbc51a7a4346e2c809f335fb46db72;p=mesa.git fix double free in 965-glsl branch --- diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 18ede5f6cdc..f689f7b3050 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1173,4 +1173,6 @@ void brw_vs_emit(struct brw_vs_compile *c ) end_inst = &p->store[p->nr_insn]; emit_vertex_write(c); post_vs_emit(c, end_inst); + for (insn = 0; insn < nr_insns; insn++) + c->vp->program.Base.Instructions[insn].Data = NULL; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f47f139282d..f03866d9b93 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1246,6 +1246,8 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) } } post_wm_emit(c); + for (i = 0; i < c->fp->program.Base.NumInstructions; i++) + c->fp->program.Base.Instructions[i].Data = NULL; } void brw_wm_glsl_emit(struct brw_wm_compile *c) diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 3215cc7218a..35babcac233 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -555,6 +555,8 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv) #endif /* free the Mesa context */ + intel->ctx.VertexProgram.Current = NULL; + intel->ctx.FragmentProgram.Current = NULL; _mesa_destroy_context(&intel->ctx); }