summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-02-23 14:50:58 +1100
committerTimothy Arceri <[email protected]>2017-02-24 09:01:59 +1100
commit987d8037cabaafaeba2cb8b82cb7fa7290dc4464 (patch)
tree417b0b89be257a9c2eb8cdfbd37dd004978726f1 /src/mesa/state_tracker
parentc24d0aaa9a197ccf7cbaa9154b840aed6397f6bd (diff)
st/mesa: free shader cache buffer on fallback
Reviewed-by: Edward O'Callaghan <[email protected]> Tested-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_shader_cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index eb66f999a5b..fba4b0a3a03 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -242,13 +242,14 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
return false;
struct st_context *st = st_context(ctx);
+ uint8_t *buffer = NULL;
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
unsigned char *sha1 = stage_sha1[i];
size_t size;
- uint8_t *buffer = (uint8_t *) disk_cache_get(ctx->Cache, sha1, &size);
+ buffer = (uint8_t *) disk_cache_get(ctx->Cache, sha1, &size);
if (buffer) {
struct blob_reader blob_reader;
blob_reader_init(&blob_reader, buffer, size);
@@ -396,6 +397,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
return true;
fallback_recompile:
+ free(buffer);
for (unsigned i = 0; i < prog->NumShaders; i++) {
_mesa_glsl_compile_shader(ctx, prog->Shaders[i], false, false, true);