Sfoglia il codice sorgente

hypervisor: fix double free in sc_hypervisor_get_ctxs_on_level()

All hypervisor examples now work as expected.
Samuel Pitoiset 9 anni fa
parent
commit
a82def595d
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      sc_hypervisor/src/sc_hypervisor.c

+ 3 - 0
sc_hypervisor/src/sc_hypervisor.c

@@ -1648,7 +1648,10 @@ void sc_hypervisor_get_ctxs_on_level(unsigned **sched_ctxs, int *nsched_ctxs, un
 		        (*sched_ctxs)[(*nsched_ctxs)++] = hypervisor.sched_ctxs[s];
 		        (*sched_ctxs)[(*nsched_ctxs)++] = hypervisor.sched_ctxs[s];
 	}
 	}
 	if(*nsched_ctxs == 0)
 	if(*nsched_ctxs == 0)
+	{
 		free(*sched_ctxs);
 		free(*sched_ctxs);
+		*sched_ctxs = NULL;
+	}
 	return;
 	return;
 }
 }