[PATCH 12/14] storageBackendCreateQemuImgSecretPath: Use memset instead of VIR_DISPOSE_N

Peter Krempa pkrempa at redhat.com
Mon Feb 1 13:39:04 UTC 2021


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 <pkrempa at redhat.com>
---
 src/storage/storage_util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 3d8de16341..303ba5fa70 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1314,7 +1314,10 @@ storageBackendCreateQemuImgSecretPath(virStoragePoolObjPtr pool,

  cleanup:
     virObjectUnref(conn);
-    VIR_DISPOSE_N(secret, secretlen);
+    if (secret) {
+        memset(secret, 0, secretlen);
+        g_free(secret);
+    }

     return secretPath;

-- 
2.29.2




More information about the libvir-list mailing list