Commit 0e52f11f authored by Muhamad Azmy's avatar Muhamad Azmy Committed by Daniel P. Berrange

virDomainListGetStats accepts a nil terminated array

virDomainListGetStats expectes a nil terminates array
hence we need to allocate the `cdoms` with len() + 1
to have a nil element at the end, otherwise this will
occasionally SIGFAULT
parent 0dfd016b
......@@ -2427,7 +2427,7 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes DomainStatsTypes,
var ret C.int
var cstats *C.virDomainStatsRecordPtr
if len(doms) > 0 {
cdoms := make([]C.virDomainPtr, len(doms))
cdoms := make([]C.virDomainPtr, len(doms)+1)
for i := 0; i < len(doms); i++ {
cdoms[i] = doms[i].ptr
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment