[PATCH 07/25] util: eliminate error label in virDomainDefFormatInternalSetRootName()

Ján Tomko jtomko at redhat.com
Thu Jun 25 23:08:36 UTC 2020


On a Wednesday in 2020, Laine Stump wrote:
>The only reason for the error label in this function is to call
>virBufferFreeAndReset(). It's actually more common for a failed format
>function to just leave the virBuffer alone and let the caller free it
>when there is a failure, and in fact the only caller of this function
>that *wasn't* already calling virBufferFreeAndReset() on failure was
>virDomainDefFormat() (via virDomainDefFormatInternal()).
>

qemuDomainDefFormatXMLInternal does not call it either.

>That is easily solved by modifying virDomainDefFormat() to declare its
>virBuffer buf with g_auto(), so that virBufferFreeAndReset() is
>automatically called.
>
>Signed-off-by: Laine Stump <laine at redhat.com>
>---
> src/conf/domain_conf.c | 88 ++++++++++++++++++++----------------------
> 1 file changed, 42 insertions(+), 46 deletions(-)

With that fixed:
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: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200626/2b64f3e3/attachment-0001.sig>


More information about the libvir-list mailing list