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 <la...@redhat.com>
---
src/conf/domain_conf.c | 88 ++++++++++++++++++++----------------------
1 file changed, 42 insertions(+), 46 deletions(-)

With that fixed:
Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

Reply via email to