Use automatic freeing of the validator context to remove
'ret'/'cleanup:'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virxml.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/util/virxml.c b/src/util/virxml.c
index e9595da97d..a2fe2e6b6d 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1671,19 +1671,15 @@ int
virXMLValidateAgainstSchema(const char *schemafile,
xmlDocPtr doc)
{
- virXMLValidator *validator = NULL;
- int ret = -1;
+ g_autoptr(virXMLValidator) validator = NULL;
if (!(validator = virXMLValidatorInit(schemafile)))
return -1;
if (virXMLValidatorValidate(validator, doc) < 0)
- goto cleanup;
+ return -1;
- ret = 0;
- cleanup:
- virXMLValidatorFree(validator);
- return ret;
+ return 0;
}
--
2.38.1