aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_sweep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_sweep.c')
-rw-r--r--src/compiler/nir/nir_sweep.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c
index faf696d6dec..e6ae298dd36 100644
--- a/src/compiler/nir/nir_sweep.c
+++ b/src/compiler/nir/nir_sweep.c
@@ -150,9 +150,17 @@ nir_sweep(nir_shader *nir)
{
void *rubbish = ralloc_context(NULL);
+ /* The shader may not own shader_info so check first */
+ bool steal_info = false;
+ if (nir == ralloc_parent(nir->info))
+ steal_info = true;
+
/* First, move ownership of all the memory to a temporary context; assume dead. */
ralloc_adopt(rubbish, nir);
+ if (steal_info)
+ ralloc_steal(nir, nir->info);
+
ralloc_steal(nir, (char *)nir->info->name);
if (nir->info->label)
ralloc_steal(nir, (char *)nir->info->label);