diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 71535f53f57a0721858b1ea983792c3ae63e75fe..9c56cdbebdf959e95a1ec910a77c0613b25abefa 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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);