Since error checking was removed when switching to g_strdup, it doesn't
make much sense to have 'tmp' around.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b731744f04..6f4487fcfc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30426,7 +30426,6 @@ virDomainDefSetMetadata(virDomainDefPtr def,
xmlDocPtr doc = NULL;
xmlNodePtr old;
xmlNodePtr new = NULL;
- char *tmp = NULL;
int ret = -1;
if (type >= VIR_DOMAIN_METADATA_LAST) {
@@ -30437,19 +30436,17 @@ virDomainDefSetMetadata(virDomainDefPtr def,
switch ((virDomainMetadataType) type) {
case VIR_DOMAIN_METADATA_DESCRIPTION:
- if (STRNEQ_NULLABLE(metadata, ""))
- tmp = g_strdup(metadata);
+ g_clear_pointer(&def->description, g_free);
- VIR_FREE(def->description);
- def->description = tmp;
+ if (STRNEQ_NULLABLE(metadata, ""))
+ def->description = g_strdup(metadata);
break;
case VIR_DOMAIN_METADATA_TITLE:
- if (STRNEQ_NULLABLE(metadata, ""))
- tmp = g_strdup(metadata);
+ g_clear_pointer(&def->title, g_free);
- VIR_FREE(def->title);
- def->title = tmp;
+ if (STRNEQ_NULLABLE(metadata, ""))
+ def->title = g_strdup(metadata);
break;
case VIR_DOMAIN_METADATA_ELEMENT:
--
2.29.2