Commit 1dfd5832 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Ensure we set parameter type correctly

When allocating a new virTypedParameter array we were forgetting
to initialize the parameter type, causing non-deterministic
failures
Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent d22f04fa
......@@ -219,11 +219,27 @@ func typedParamsPackNew(infomap map[string]typedParamsFieldInfo) (*[]C.virTypedP
if value.sl != nil {
for i := 0; i < len(*value.sl); i++ {
cparam := &cparams[nparams]
cparam._type = C.VIR_TYPED_PARAM_STRING
C.memcpy(unsafe.Pointer(&cparam.field[0]), unsafe.Pointer(cfield), C.size_t(clen))
nparams++
}
} else {
cparam := &cparams[nparams]
if value.i != nil {
cparam._type = C.VIR_TYPED_PARAM_INT
} else if value.ui != nil {
cparam._type = C.VIR_TYPED_PARAM_UINT
} else if value.l != nil {
cparam._type = C.VIR_TYPED_PARAM_LLONG
} else if value.ul != nil {
cparam._type = C.VIR_TYPED_PARAM_ULLONG
} else if value.b != nil {
cparam._type = C.VIR_TYPED_PARAM_BOOLEAN
} else if value.d != nil {
cparam._type = C.VIR_TYPED_PARAM_DOUBLE
} else if value.s != nil {
cparam._type = C.VIR_TYPED_PARAM_STRING
}
C.memcpy(unsafe.Pointer(&cparam.field[0]), unsafe.Pointer(cfield), C.size_t(clen))
nparams++
}
......
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