diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 90752635cfa410909fe4fe2c2c803e33e2b5ab9a..1745649f9374902a1757139e103bad709352e6a1 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -467,7 +467,7 @@ virNumaGetDistances(int node, if ((max_node = virNumaGetMaxNode()) < 0) goto cleanup; - if (VIR_ALLOC_N(*distances, max_node) < 0) + if (VIR_ALLOC_N(*distances, max_node + 1) < 0) goto cleanup; *ndistances = max_node + 1;