From: Barrett Schonefeld <bschoney(a)utexas.edu>
- src/util/virstorageencryption.c
Signed-off-by: Barrett Schonefeld <bschoney(a)utexas.edu>
---
src/util/virstorageencryption.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c
index 399c6926bd..ed29b4cfa5 100644
--- a/src/util/virstorageencryption.c
+++ b/src/util/virstorageencryption.c
@@ -142,7 +142,7 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
{
VIR_XPATH_NODE_AUTORESTORE(ctxt)
virStorageEncryptionSecretPtr ret;
- char *type_str = NULL;
+ g_autofree char *type_str = NULL;
ret = g_new0(virStorageEncryptionSecret, 1);
@@ -164,12 +164,9 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
if (virSecretLookupParseSecret(node, &ret->seclookupdef) < 0)
goto cleanup;
- VIR_FREE(type_str);
-
return ret;
cleanup:
- VIR_FREE(type_str);
virStorageEncryptionSecretFree(ret);
return NULL;
}
@@ -180,7 +177,7 @@ virStorageEncryptionInfoParseCipher(xmlNodePtr info_node,
virStorageEncryptionInfoDefPtr info)
{
int ret = -1;
- char *size_str = NULL;
+ g_autofree char *size_str = NULL;
if (!(info->cipher_name = virXMLPropString(info_node, "name"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -208,7 +205,6 @@ virStorageEncryptionInfoParseCipher(xmlNodePtr info_node,
ret = 0;
cleanup:
- VIR_FREE(size_str);
return ret;
}
@@ -237,7 +233,7 @@ virStorageEncryptionParseNode(xmlNodePtr node,
xmlNodePtr *nodes = NULL;
virStorageEncryptionPtr encdef = NULL;
virStorageEncryptionPtr ret = NULL;
- char *format_str = NULL;
+ g_autofree char *format_str = NULL;
int n;
size_t i;
@@ -297,7 +293,6 @@ virStorageEncryptionParseNode(xmlNodePtr node,
ret = g_steal_pointer(&encdef);
cleanup:
- VIR_FREE(format_str);
VIR_FREE(nodes);
virStorageEncryptionFree(encdef);
--
2.29.0