On 09/11/2013 08:12 AM, Giuseppe Scrivano wrote:
The new function virConnectGetCPUModelNames allows to retrieve the
list
of CPU models known by the hypervisor for a specific architecture.
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
+int
+virConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models,
+ unsigned int flags)
+{
+ VIR_DEBUG("conn=%p, arch=%s, flags=%x", conn, arch, flags);
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
Oh, I also missed another point of consistency with our ListAll
functions - we guarantee that if models is non-NULL, it will be
sanitized on all error paths. Squashing this in, too:
diff --git i/src/libvirt.c w/src/libvirt.c
index b31b561..b9b9459 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -18545,6 +18545,9 @@ virConnectGetCPUModelNames(virConnectPtr conn,
const char *arch, char ***models,
VIR_DEBUG("conn=%p, arch=%s, flags=%x", conn, arch, flags);
virResetLastError();
+ if (models)
+ *models = NULL;
+
if (!VIR_IS_CONNECT(conn)) {
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
virDispatchError(NULL);
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org