Phase out use of VIR_DISPOSE_N from the qemu driver. Use memset in the
appropriate cases.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2c34307c82..7f3f704bf4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -443,7 +443,10 @@ qemuDomainMasterKeyFree(qemuDomainObjPrivatePtr priv)
if (!priv->masterKey)
return;
- VIR_DISPOSE_N(priv->masterKey, priv->masterKeyLen);
+ if (priv->masterKey) {
+ memset(priv->masterKey, 0, priv->masterKeyLen);
+ g_clear_pointer(&priv->masterKey, g_free);
+ }
}
/* qemuDomainMasterKeyReadFile:
@@ -584,7 +587,10 @@ static void
qemuDomainSecretPlainClear(qemuDomainSecretPlainPtr secret)
{
VIR_FREE(secret->username);
- VIR_DISPOSE_N(secret->secret, secret->secretlen);
+ if (secret->secret) {
+ memset(secret->secret, 0, secret->secretlen);
+ g_clear_pointer(&secret->secret, g_free);
+ }
}
@@ -1143,7 +1149,8 @@ qemuDomainSecretAESSetupFromSecret(qemuDomainObjPrivatePtr priv,
secinfo = qemuDomainSecretAESSetup(priv, alias, username, secret, secretlen);
- VIR_DISPOSE_N(secret, secretlen);
+ memset(secret, 0, secretlen);
+ g_free(secret);
return secinfo;
}
--
2.29.2