提交 0018477f 编写于 作者: P Peter Krempa

conf: Add helper do clear disk source authentication struct

Add virDomainDiskAuthClear to help cleaning out the struct in other
places too.
上级 d8cf91ae
......@@ -1201,12 +1201,9 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
VIR_FREE(def->driverName);
virStorageFileFreeMetadata(def->backingChain);
VIR_FREE(def->mirror);
VIR_FREE(def->auth.username);
VIR_FREE(def->wwn);
VIR_FREE(def->vendor);
VIR_FREE(def->product);
if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_USAGE)
VIR_FREE(def->auth.secret.usage);
virStorageEncryptionFree(def->encryption);
virDomainDeviceInfoClear(&def->info);
......@@ -1217,10 +1214,24 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
}
virDomainDiskHostDefFree(def->nhosts, def->hosts);
virDomainDiskAuthClear(def);
VIR_FREE(def);
}
void
virDomainDiskAuthClear(virDomainDiskDefPtr def)
{
VIR_FREE(def->auth.username);
if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_USAGE)
VIR_FREE(def->auth.secret.usage);
def->auth.secretType = VIR_DOMAIN_DISK_SECRET_TYPE_NONE;
}
void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def)
{
if (!def)
......
......@@ -2209,6 +2209,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def);
void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
void virDomainDiskAuthClear(virDomainDiskDefPtr def);
void virDomainDiskHostDefClear(virDomainDiskHostDefPtr def);
void virDomainDiskHostDefFree(size_t nhosts, virDomainDiskHostDefPtr hosts);
virDomainDiskHostDefPtr virDomainDiskHostDefCopy(size_t nhosts,
......
......@@ -180,6 +180,7 @@ virDomainDeviceFindControllerModel;
virDomainDeviceInfoCopy;
virDomainDeviceInfoIterate;
virDomainDeviceTypeToString;
virDomainDiskAuthClear;
virDomainDiskBusTypeToString;
virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册