virCommandToString returns an allocated buffer, so using it directly as argument of virBufferAdd which doesn't consume the string causes it to be leaked. Switch to virBufferToStringBuf since we are already using a buffer. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/bhyve/bhyve_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 0fddf9533b..fc696a50a7 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -723,14 +723,14 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn, "<device.map>", NULL))) goto cleanup; - virBufferAdd(&buf, virCommandToString(loadcmd, false), -1); + virBufferToStringBuf(loadcmd, &buf, false, false); virBufferAddChar(&buf, '\n'); } if (!(cmd = virBhyveProcessBuildBhyveCmd(privconn, def, true))) goto cleanup; - virBufferAdd(&buf, virCommandToString(cmd, false), -1); + virBufferToStringBuf(cmd, &buf, false, false); ret = virBufferContentAndReset(&buf); -- 2.31.1