Re: [PATCH v3 2/3] Add support for schema validation when passing in XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 13, 2015 at 17:00:15 +0000, Daniel Berrange wrote:
> The virDomainDefineXMLFlags and virDomainCreateXML APIs both
> gain new flags allowing them to be told to validate XML.
> This updates all the drivers to turn on validation in the
> XML parser when the flags are set
...
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b316b4b..420f94b 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
...
> @@ -12647,6 +12648,16 @@ virDomainDefParseXML(xmlDocPtr xml,
>      bool usb_master = false;
>      bool primaryVideo = false;
>  
> +    if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE) {
> +        char *schema = virFileFindResource("domain.rng",
> +                                           "docs/schemas",
> +                                           PKGDATADIR "/schemas");
> +        if (!schema)
> +            return NULL;
> +        if (virXMLValidateAgainstSchema(schema, xml) < 0)
> +            return NULL;

This will leak schema.

> +    }
> +
>      if (VIR_ALLOC(def) < 0)
>          return NULL;
>  
...

ACK with the memory leak fixed.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]