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

Re: [libvirt] [PATCH 02/17] Avoid leak if virDomainSoundCodecDefParseXML return error



On Tue, Sep 24, 2013 at 11:03 AM, Daniel P. Berrange
<berrange redhat com> wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
>
> If virDomainSoundCodecDefParseXML returns an error (eg due
> to OOM), then the xml nodeset codecNodes is leaked.
>
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  src/conf/domain_conf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 81314bc..ccb61aa 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -8470,8 +8470,10 @@ virDomainSoundDefParseXML(const xmlNodePtr node,
>
>              for (i = 0; i < ncodecs; i++) {
>                  virDomainSoundCodecDefPtr codec = virDomainSoundCodecDefParseXML(codecNodes[i]);
> -                if (codec == NULL)
> +                if (codec == NULL) {
> +                    VIR_FREE(codecNodes);
>                      goto error;
> +                }
>
>                  codec->cad = def->ncodecs; /* that will do for now */
>                  def->codecs[def->ncodecs++] = codec;
> --
> 1.8.3.1
>
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK

-- 
Doug Goldstein


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