mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virDomainDiskSourceFormatInternal: Avoid leaking @childBuf
If formatting of storage encryption or private data fails we must jump to the error label instead of returning immediately otherwise @attrBuf and @childBuf might be leaked. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a4ace767cd
commit
4e657f2ae2
@ -22911,10 +22911,10 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf,
|
|||||||
* as we found it. */
|
* as we found it. */
|
||||||
if (src->encryption && src->encryptionInherited &&
|
if (src->encryption && src->encryptionInherited &&
|
||||||
virStorageEncryptionFormat(&childBuf, src->encryption) < 0)
|
virStorageEncryptionFormat(&childBuf, src->encryption) < 0)
|
||||||
return -1;
|
goto error;
|
||||||
|
|
||||||
if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0)
|
if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0)
|
||||||
return -1;
|
goto error;
|
||||||
|
|
||||||
if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
|
if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user