[Mesa-dev] [PATCH] nv50: avoid freeing the symbols if they're about to be stored

Ilia Mirkin imirkin at alum.mit.edu
Wed Feb 3 18:53:57 UTC 2016


Spotted by Coverity

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/gallium/drivers/nouveau/nv50/nv50_program.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 888d62e..e742099 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -403,10 +403,13 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
          break;
       }
       prog->gp.vert_count = info->prop.gp.maxVertices;
-   } else
+   }
+
    if (prog->type == PIPE_SHADER_COMPUTE) {
       prog->cp.syms = info->bin.syms;
       prog->cp.num_syms = info->bin.numSyms;
+   } else {
+      FREE(info->bin.syms);
    }
 
    if (prog->pipe.stream_output.num_outputs)
@@ -507,6 +510,9 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p)
    FREE(p->interps);
    FREE(p->so);
 
+   if (type == PIPE_SHADER_COMPUTE)
+      FREE(p->cp.syms);
+
    memset(p, 0, sizeof(*p));
 
    p->pipe = pipe;
-- 
2.4.10



More information about the mesa-dev mailing list