[Mesa-dev] [PATCH] st/mesa: Fix memory leak on error path.

Vinson Lee vlee at vmware.com
Sat Nov 5 22:37:28 PDT 2011


Fixes Coverity resource leak defect.
---
 src/mesa/state_tracker/st_program.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 146e77f..8cd039c 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -632,8 +632,10 @@ st_translate_fragment_program(struct st_context *st,
       }
 
       ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
-      if (ureg == NULL)
+      if (ureg == NULL) {
+         FREE(variant);
          return NULL;
+      }
 
       if (ST_DEBUG & DEBUG_MESA) {
          _mesa_print_program(&stfp->Base.Base);
-- 
1.7.7



More information about the mesa-dev mailing list