[Libosinfo] [PATCH 1/5] loader: fix memory leaks when loading data

Christophe Fergeau cfergeau at redhat.com
Wed Oct 7 07:24:14 UTC 2015


Hey,

On Tue, Oct 06, 2015 at 05:40:59PM +0100, Daniel P. Berrange wrote:
> The 'lang' attribute needs to be free'd with xmlFree.
> 
> The install script config param needs to be unref'd
> since when it is added to the install script an extra
> ref is taken.
> 
> The install script avatar needs to be unref'd since
> when it is added to the intsall script an extra ref is

s/intsall/install/

> taken.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  osinfo/osinfo_loader.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index 4e8f942..0c7ddfb 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -342,6 +342,7 @@ static void osinfo_loader_entity(OsinfoLoader *loader,
>                              break;

'lang' will still be leaked when this 'break' is reached.

ACK otherwise.

Christophe

>                          }
>                      }
> +                    xmlFree(lang);
>                  }
>              }
>          }
> @@ -780,6 +781,7 @@ static void osinfo_loader_install_config_params(OsinfoLoader *loader,
>          xmlFree(mapid);
>          xmlFree(name);
>          xmlFree(policy);
> +        g_object_unref(param);
>      };
>  
>      g_free(nodes);
> @@ -889,6 +891,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
>              goto error;
>  
>          osinfo_install_script_set_avatar_format(installScript, avatar_format);
> +        g_object_unref(avatar_format);
>      }
>      g_free(nodes);
>  
> -- 
> 2.4.3
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20151007/bd297904/attachment.sig>


More information about the Libosinfo mailing list