spapr: fix write-past-end-of-array error in cpu core device init code

This fixes a potential QEMU crash introduced by commit 3b54254966.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Greg Kurz 2016-06-27 18:28:15 +02:00 committed by David Gibson
parent 6cc09e261b
commit dde35bc966

View File

@ -309,10 +309,9 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
}
err:
while (i >= 0) {
while (--i >= 0) {
obj = sc->threads + i * size;
object_unparent(obj);
i--;
}
g_free(sc->threads);
error_propagate(errp, local_err);