提交 1dd32828 编写于 作者: M Michal Privoznik

virDomainGenerateMachineName: Use g_autofree for @username

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 06a19921
......@@ -31080,18 +31080,17 @@ virDomainGenerateMachineName(const char *drivername,
const char *name,
bool privileged)
{
char *username = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
if (privileged) {
virBufferAsprintf(&buf, "%s-", drivername);
} else {
g_autofree char *username = NULL;
if (!(username = virGetUserName(geteuid()))) {
virBufferFreeAndReset(&buf);
return NULL;
}
virBufferAsprintf(&buf, "%s-%s-", username, drivername);
VIR_FREE(username);
}
virBufferAsprintf(&buf, "%d-", id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册