mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
util: xml: Refactor cleanup in virXMLValidateAgainstSchema
Use automatic freeing of the validator context to remove 'ret'/'cleanup:'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3e10557766
commit
868ffe3b90
@ -1567,19 +1567,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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user