qemu: fix memleak in virCapabilitiesDomainDataLookup
virBufferContentAndReset() doesn't free buf contents, we should use virBufferFreeAndReset() to get buf freed. Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
This commit is contained in:
parent
0a8bd97afa
commit
768ec8c16d
@ -701,13 +701,14 @@ virCapabilitiesDomainDataLookup(virCapsPtr caps,
|
|||||||
!virBufferCurrentContent(&buf)[0])
|
!virBufferCurrentContent(&buf)[0])
|
||||||
virBufferAsprintf(&buf, "%s", _("any configuration"));
|
virBufferAsprintf(&buf, "%s", _("any configuration"));
|
||||||
if (virBufferCheckError(&buf) < 0) {
|
if (virBufferCheckError(&buf) < 0) {
|
||||||
virBufferContentAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("could not find capabilities for %s"),
|
_("could not find capabilities for %s"),
|
||||||
virBufferContentAndReset(&buf));
|
virBufferCurrentContent(&buf));
|
||||||
|
virBufferFreeAndReset(&buf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user