virt-host-validate-common: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-07 16:34:00 +01:00
parent 4c4b4b3691
commit 68919edb3b

View File

@ -330,7 +330,7 @@ int virHostValidateCGroupControllers(const char *hvname G_GNUC_UNUSED,
int virHostValidateIOMMU(const char *hvname,
virHostValidateLevel level)
{
virBitmap *flags;
g_autoptr(virBitmap) flags = NULL;
struct stat sb;
const char *bootarg = NULL;
bool isAMD = false, isIntel = false;
@ -347,8 +347,6 @@ int virHostValidateIOMMU(const char *hvname,
else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SVM))
isAMD = true;
virBitmapFree(flags);
if (isIntel) {
if (access("/sys/firmware/acpi/tables/DMAR", F_OK) == 0) {
virHostMsgPass();
@ -445,7 +443,7 @@ bool virHostKernelModuleIsLoaded(const char *module)
int virHostValidateSecureGuests(const char *hvname,
virHostValidateLevel level)
{
virBitmap *flags;
g_autoptr(virBitmap) flags = NULL;
bool hasFac158 = false;
bool hasAMDSev = false;
virArch arch = virArchFromHost();
@ -460,8 +458,6 @@ int virHostValidateSecureGuests(const char *hvname,
else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SEV))
hasAMDSev = true;
virBitmapFree(flags);
virHostMsgCheck(hvname, "%s", _("for secure guest support"));
if (ARCH_IS_S390(arch)) {
if (hasFac158) {