[PATCH 13/13] virshFindDisk: Sanitize use of 'tmp' variable

Ján Tomko jtomko at redhat.com
Fri Dec 2 15:41:42 UTC 2022


On a Friday in 2022, Peter Krempa wrote:
>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.

where did the + come from?

>
>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 at redhat.com>
>---
> tools/virsh-domain.c | 48 +++++++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 23 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20221202/d0c402ee/attachment.sig>


More information about the libvir-list mailing list