clone_reg_list(&state, &ns->registers, &s->registers);
ns->reg_alloc = s->reg_alloc;
- ns->info = s->info;
+ *ns->info = *s->info;
ns->info->name = ralloc_strdup(ns, ns->info->name);
if (ns->info->label)
ns->info->label = ralloc_strdup(ns, ns->info->label);
{
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);