[Mesa-dev] [PATCH 12/17] i965/fs: Actually free program data on the error path.

Kenneth Graunke kenneth at whitecape.org
Thu May 15 23:19:43 PDT 2014


We throw away the data generated during compilation on the success path,
so we really ought to on the failure path as well.  The caller has no
access to it anyway, so it's purely leaked.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_wm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 5242715..059d848 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -181,8 +181,10 @@ bool do_wm_prog(struct brw_context *brw,
                                            &fp->program);
 
    program = brw_wm_fs_emit(brw, c, &fp->program, prog, &program_size);
-   if (program == NULL)
+   if (program == NULL) {
+      ralloc_free(c);
       return false;
+   }
 
    if (c->prog_data.total_scratch) {
       brw_get_scratch_bo(brw, &brw->wm.base.scratch_bo,
-- 
1.9.2



More information about the mesa-dev mailing list