[PATCH 7/8] util: rename virStorageEncryptionInfoDefFree()

Laine Stump laine at redhat.com
Mon Feb 1 06:27:19 UTC 2021


usually a function call vir*Free() will take a single pointer to an
object as its argument, and will then free all resources associated
with that object, including the object
itself. virStorageEnctyptionInfoDefFree() doesn't do that - it frees
all the subordinate resources of the ojbect, but doesn't free the
object itself; usually a function like that is called
vir*Clear(). Let's rename this function to not be misleading.

Signed-off-by: Laine Stump <laine at redhat.com>
---
 src/conf/storage_encryption_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 34ad5dffeb..6a32df15b7 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -48,7 +48,7 @@ VIR_ENUM_IMPL(virStorageEncryptionFormat,
 );
 
 static void
-virStorageEncryptionInfoDefFree(virStorageEncryptionInfoDefPtr def)
+virStorageEncryptionInfoDefClear(virStorageEncryptionInfoDefPtr def)
 {
     VIR_FREE(def->cipher_name);
     VIR_FREE(def->cipher_mode);
@@ -77,7 +77,7 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
 
     for (i = 0; i < enc->nsecrets; i++)
         virStorageEncryptionSecretFree(enc->secrets[i]);
-    virStorageEncryptionInfoDefFree(&enc->encinfo);
+    virStorageEncryptionInfoDefClear(&enc->encinfo);
     VIR_FREE(enc->secrets);
     VIR_FREE(enc);
 }
-- 
2.29.2




More information about the libvir-list mailing list