[virglrenderer-devel] [PATCH] renderer: fix memory leak in add shader program

Li Qiang liq3ea at gmail.com
Sat Jan 7 06:24:30 UTC 2017


Free 'sprog' in error path to avoid memory leak.

Signed-off-by: Li Qiang <liq3ea at gmail.com>
---
 src/vrend_renderer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 32e2e7d..ad68f71 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -892,6 +892,7 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
          fprintf(stderr,"geom shader: %d GLSL\n%s\n", gs->id, gs->glsl_prog);
       fprintf(stderr,"frag shader: %d GLSL\n%s\n", fs->id, fs->glsl_prog);
       glDeleteProgram(prog_id);
+      free(sprog);
       return NULL;
    }
 
-- 
2.7.4



More information about the virglrenderer-devel mailing list