[libvirt] [PATCH 07/14] virsh-completer: virStringListFree where possible

Peter Krempa pkrempa at redhat.com
Wed Apr 3 07:54:28 UTC 2019


On Mon, Apr 01, 2019 at 09:33:24 +0200, Ján Tomko wrote:
> We've been open-coding virStringListFreeCount for cleaning up
> the completion list we're building. This had the advantage of
> zeoring the pointer afterwards, which is no longer needed
> now that we compile the list in 'tmp' instead of 'ret'.

But now you are not preserving the holy NULLs on the stack!!.

> 
> Since all our lists are NULL-terminated anyway, switch to using
> virStringListFree which has the benefit of being usable with
> our VIR_AUTOSTRINGLIST macro.
> 
> Fixes nearly impossible NULL dereferences in
>   virshNWFilterBindingNameCompleter
>   virshNWFilterNameCompleter
>   virshNodeDeviceNameCompleter
>   virshNetworkNameCompleter
>   virshInterfaceNameCompleter
>   virshStoragePoolNameCompleter
>   virshDomainNameCompleter
> which jumped on the error label after a failed allocation
> and a possible one in
>   virshStorageVolNameCompleter
> which jumped there when we fail to fetch the list of volumes.
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---

ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190403/e3ae173e/attachment-0001.sig>


More information about the libvir-list mailing list