On Mon, Jun 20, 2016 at 04:34:20PM +0200, Peter Krempa wrote:
Allow gathering available vcpu ids, their state and offlinability
via
the qemu guest agent. The maximum id was chosen arbitrarily and ought
to be enough for everybody.
---
[...]
+#define ADD_BITMAP(name)
\
+ if (!(tmp = virBitmapFormat(name))) \
+ goto cleanup; \
+ if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0)
\
+ goto cleanup; \
+ VIR_FREE(tmp)
+
+ ADD_BITMAP(vcpus);
+ ADD_BITMAP(online);
+ ADD_BITMAP(offlinable);
+
+#undef ADD_BITMAP
+
+ *params = par;
+ *nparams = npar;
You need to set par to NULL and to make it clear also npar to 0 and call
virTypedParamsFree(par, npar) in the cleanup.
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(tmp);
+ virBitmapFree(vcpus);
+ virBitmapFree(online);
+ virBitmapFree(offlinable);
+ return ret;
+}
ACK