[virt-tools-list] [libosinfo PATCH] Fix libxml error reporting

Guido Günther agx at sigxcpu.org
Fri Nov 18 22:03:41 UTC 2011


The error code might be set in catchXMLError so make sure we don't miss
it. Otherwise this results in errors like:

/usr/lib/python2.7/dist-packages/gi/types.py:43: Warning: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Incorrect root element
---
 osinfo/osinfo_loader.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 8a3de6a..e479301 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -805,7 +805,7 @@ static void osinfo_loader_process_xml(OsinfoLoader *loader,
     xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, src, NULL,
                          XML_PARSE_NOENT | XML_PARSE_NONET |
                          XML_PARSE_NOWARNING);
-    if (!xml)
+    if (!xml || *err)
         goto cleanup;
 
     root = xmlDocGetRootElement(xml);
-- 
1.7.7.1




More information about the virt-tools-list mailing list