]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virshFindDisk: Sanitize use of 'tmp' variable
authorPeter Krempa <pkrempa@redhat.com>
Wed, 19 Oct 2022 11:59:17 +0000 (13:59 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 2 Dec 2022 15:49:25 +0000 (16:49 +0100)
commit22766a1a5371ce20579c503363e0d9b27091e393
treeb03e7a62d8f0641676301ee1c59b5ceacfa21dac
parent1a136152e6bcaac031b6d41dbe6f4fbd805b4d46
virshFindDisk: Sanitize use of 'tmp' variable

The return value of virXMLPropString was assigned into 'tmp' multiple
times and to prevent static analyzers moaning about a potential leak a
short-circuited if logic or was used.

Replace the code by having a helper variable for each possibility and
also replace the for-loop to iterate elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virsh-domain.c