On Fri, Mar 20, 2026 at 16:19:23 -0500, Jonathon Jongsma via Devel wrote:
> Signed-off-by: Jonathon Jongsma <[email protected]>
> ---
>  src/hyperv/hyperv_wmi.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
> index 14df670fa1..3e161429d5 100644
> --- a/src/hyperv/hyperv_wmi.c
> +++ b/src/hyperv/hyperv_wmi.c
> @@ -548,7 +548,7 @@ hypervSerializeEmbeddedParam(hypervParam *p, const char 
> *resourceUri,
>      hypervWmiClassInfo *classInfo = p->embedded.info;
>      g_autofree virHashKeyValuePair *items = NULL;
>      hypervCimType *property = NULL;
> -    ssize_t numKeys = -1;
> +    size_t numKeys = 0;
>      int len = 0, i = 0;
>  
>      if (!(xmlNodeParam = ws_xml_add_child(*methodNode, resourceUri, 
> p->embedded.name,
> @@ -582,8 +582,7 @@ hypervSerializeEmbeddedParam(hypervParam *p, const char 
> *resourceUri,
>      }
>  
>      /* retrieve parameters out of hash table */
> -    numKeys = virHashSize(p->embedded.table);
> -    items = virHashGetItems(p->embedded.table, NULL, false);
> +    items = virHashGetItems(p->embedded.table, &numKeys, false);


Since the array of items returned from virHashGetItems is NULL
terminated you can also use a NULL '.key' member in the condition
instead of the number.


>      if (!items) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("Could not read embedded param hash table"));

Regardless of the above:

Reviewed-by: Peter Krempa <[email protected]>

Reply via email to