]> xenbits.xensource.com Git - libvirt.git/commit
virTypedParamsGetStringList: Ensure that returned array is NULL if there are no match...
authorPeter Krempa <pkrempa@redhat.com>
Fri, 27 Sep 2024 11:01:22 +0000 (13:01 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 1 Oct 2024 10:57:02 +0000 (12:57 +0200)
commit7933310ce95a7a620da6868ea7e7f822b3f8a6a3
tree2cfa3a00c27e5a16d6192bcc4423cd1da8689a66
parentb74fed01730beac3e7d6d31b35b771a0bf559be2
virTypedParamsGetStringList: Ensure that returned array is NULL if there are no matching fields

'virTypedParamsGetStringList' fills the returned array only with string
parameters with matching name. The filtering code though leaves the
possibility that all items are filtered out but the return array is
still (over)allocated.

Since 'virTypedParamsFilter()' now also allows filtering by type we can
move the filtering there ensuring that we always allocate the right
number of elements and more importantly the returned array will be NULL
if none elements are present.

Rework the code and adjust docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/util/virtypedparam.c