summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-09-12 10:52:25 +1000
committerOlivier Fourdan <ofourdan@redhat.com>2018-10-04 17:26:15 +0200
commit795c58a1febb3deb9066d981b178d9cf14fdad03 (patch)
tree97f2115dcc90d9284476bd689c607d99f25a7f52
parentbb384d0b110a99f2d935ed73d6589af46f818823 (diff)
glamor: fix leak of fs_getcolor_source.
This is created using XNFstrdup, so it needs to be freed. Pointed out by coverity. Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit f0a5c0d1fdaeee3cd701215f4f57b7eacaf783c2)
-rw-r--r--glamor/glamor_gradient.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
index 4e864cd79..eef078860 100644
--- a/glamor/glamor_gradient.c
+++ b/glamor/glamor_gradient.c
@@ -38,7 +38,7 @@
#define RADIAL_SMALL_STOPS (6 + 2)
#define RADIAL_LARGE_STOPS (16 + 2)
-static const char *
+static char *
_glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
int use_array)
{
@@ -310,7 +310,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
"}\n"\
"\n"\
"%s\n" /* fs_getcolor_source */
- const char *fs_getcolor_source;
+ char *fs_getcolor_source;
glamor_priv = glamor_get_screen_private(screen);
@@ -343,6 +343,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs);
free(gradient_fs);
+ free(fs_getcolor_source);
glAttachShader(gradient_prog, vs_prog);
glAttachShader(gradient_prog, fs_prog);
@@ -493,7 +494,7 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
"}\n"\
"\n"\
"%s" /* fs_getcolor_source */
- const char *fs_getcolor_source;
+ char *fs_getcolor_source;
glamor_priv = glamor_get_screen_private(screen);
@@ -522,6 +523,7 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, gradient_fs);
free(gradient_fs);
+ free(fs_getcolor_source);
glAttachShader(gradient_prog, vs_prog);
glAttachShader(gradient_prog, fs_prog);