st/mesa: Fix memory leak on error path.
authorVinson Lee <vlee@vmware.com>
Sun, 6 Nov 2011 05:36:08 +0000 (22:36 -0700)
committerVinson Lee <vlee@vmware.com>
Tue, 8 Nov 2011 04:41:21 +0000 (20:41 -0800)
Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/mesa/state_tracker/st_program.c

index 6c1568dcfa9fcf8eafb9264cbb6470e1f12c3376..e03157940b1f010d871e7cc78b3745afd192acdf 100644 (file)
@@ -636,8 +636,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);