提交 4e657f2a 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 a4ace767
......@@ -22911,10 +22911,10 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf,
* as we found it. */
if (src->encryption && src->encryptionInherited &&
virStorageEncryptionFormat(&childBuf, src->encryption) < 0)
return -1;
goto error;
if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0)
return -1;
goto error;
if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册