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

Re: [libvirt] [PATCH 05/10] lock: avoid leak on failure



On Thu, Jun 02, 2011 at 05:07:57PM -0600, Eric Blake wrote:
> Detected by Coverity.  Only possible on OOM situations.
> 
> * src/locking/lock_manager.c (virLockManagerPluginNew): Plug leak.
> ---
>  src/locking/lock_manager.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
> index 6197fd4..138cc91 100644
> --- a/src/locking/lock_manager.c
> +++ b/src/locking/lock_manager.c
> @@ -120,7 +120,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
>  {
>      void *handle = NULL;
>      virLockDriverPtr driver;
> -    virLockManagerPluginPtr plugin;
> +    virLockManagerPluginPtr plugin = NULL;
>      const char *moddir = getenv("LIBVIRT_LOCK_MANAGER_PLUGIN_DIR");
>      char *modfile = NULL;
> 
> @@ -182,6 +182,7 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
>      return plugin;
> 
>  cleanup:
> +    VIR_FREE(plugin);
>      VIR_FREE(modfile);
>      if (handle)
>          dlclose(handle);

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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