Mesa (master): pp: Fix memory leak on error path.

Vinson Lee vlee at kemper.freedesktop.org
Tue Oct 25 14:39:20 UTC 2011


Module: Mesa
Branch: master
Commit: ca1b60057aaf7f10f9cdbdbcd75cf3f53c751d64
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca1b60057aaf7f10f9cdbdbcd75cf3f53c751d64

Author: Vinson Lee <vlee at vmware.com>
Date:   Mon Oct 24 14:45:39 2011 -0700

pp: Fix memory leak on error path.

Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/postprocess/pp_program.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c
index c287af5..1a8a584 100644
--- a/src/gallium/auxiliary/postprocess/pp_program.c
+++ b/src/gallium/auxiliary/postprocess/pp_program.c
@@ -41,12 +41,13 @@ struct program *
 pp_init_prog(struct pp_queue_t *ppq, struct pipe_screen *pscreen)
 {
 
-   struct program *p = CALLOC(1, sizeof(struct program));
+   struct program *p;
 
    pp_debug("Initializing program\n");
    if (!pscreen)
       return NULL;
 
+   p = CALLOC(1, sizeof(struct program));
    if (!p)
       return NULL;
 




More information about the mesa-commit mailing list