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

Daniel P. Berrange berrange at redhat.com
Tue Oct 6 16:40:59 UTC 2015


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
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;
                         }
                     }
+                    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




More information about the Libosinfo mailing list