Clear out the value using an explicit memset and free it with g_free so
that VIR_DISPOSE_N can be phased out.

Signed-off-by: Peter Krempa <[email protected]>
---
 src/util/vircrypto.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
index c4874550af..82281a070a 100644
--- a/src/util/vircrypto.c
+++ b/src/util/vircrypto.c
@@ -206,7 +206,8 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t 
gnutls_enc_alg,
     return 0;

  error:
-    VIR_DISPOSE_N(ciphertext, ciphertextlen);
+    memset(ciphertext, 0, ciphertextlen);
+    g_free(ciphertext);
     memset(&enc_key, 0, sizeof(gnutls_datum_t));
     memset(&iv_buf, 0, sizeof(gnutls_datum_t));
     return -1;
-- 
2.29.2

Reply via email to