[libvirt] [PATCH 2/4] interface: avoid memory leak on parse error

Wen Congyang wency at cn.fujitsu.com
Fri Jul 1 00:54:16 UTC 2011


At 07/01/2011 07:36 AM, Eric Blake Write:
> Detected by Coverity.  Unlikely to hit unless the file contents
> were corrupted.
> 
> * src/util/interface.c (ifaceRestoreMacAddress): Plug leak.
> ---
>  src/util/interface.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/util/interface.c b/src/util/interface.c
> index d51ceec..f486124 100644
> --- a/src/util/interface.c
> +++ b/src/util/interface.c
> @@ -1,6 +1,7 @@
>  /*
>   * interface.c: interface support functions
>   *
> + * Copyright (C) 2011 Red Hat, Inc.
>   * Copyright (C) 2010 IBM Corp.
>   * Copyright (C) 2010 Stefan Berger
>   *
> @@ -1100,6 +1101,7 @@ ifaceRestoreMacAddress(const char *linkdev,
>          ifaceError(VIR_ERR_INTERNAL_ERROR,
>                     _("Cannot parse MAC address from '%s'"),
>                     oldmacname);
> +        VIR_FREE(macstr);
>          return -1;
>      }
> 
ACK




More information about the libvir-list mailing list