summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-09-10 08:47:16 -0600
committerBrian Paul <[email protected]>2015-09-10 12:23:46 -0600
commit289804515f7de20cb41a5e1b4c20864f0dab8d51 (patch)
tree94b8df19fe074bffbe0e3b8352d362c1d5500ac7 /src/gallium/drivers
parentece33f96879775401361d14cb2faeb1a2f1ea806 (diff)
svga: fix shader variant memory leak
Fixes a small leak in a seldom-hit corner case for VS/FS compilation. Found with coverity. Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/svga/svga_state_fs.c3
-rw-r--r--src/gallium/drivers/svga/svga_state_vs.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 849319d3cf3..5d39100f63a 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -148,6 +148,9 @@ compile_fs(struct svga_context *svga,
" using dummy shader instead.\n",
(unsigned) (variant->nr_tokens
* sizeof(variant->tokens[0])));
+ /* Free the too-large variant */
+ svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_PS, variant);
+ /* Use simple pass-through shader instead */
variant = get_compiled_dummy_shader(svga, fs, key);
if (!variant) {
ret = PIPE_ERROR;
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index 45dcb5d0f76..de41519593c 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -139,6 +139,9 @@ compile_vs(struct svga_context *svga,
" using dummy shader instead.\n",
(unsigned) (variant->nr_tokens
* sizeof(variant->tokens[0])));
+ /* Free the too-large variant */
+ svga_destroy_shader_variant(svga, SVGA3D_SHADERTYPE_VS, variant);
+ /* Use simple pass-through shader instead */
variant = get_compiled_dummy_vertex_shader(svga, vs, key);
if (!variant) {
ret = PIPE_ERROR;