[Libvirt-cim] [PATCH] Make sure to set status in eo_parser_xml to avoid crash

Dan Smith danms at us.ibm.com
Thu Feb 21 15:44:11 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1203608641 28800
# Node ID 393e3ca977954e41883756bc8c1093ed20f2e601
# Parent  c19e321766902af6dba29025be964d8d45537c51
Make sure to set status in eo_parser_xml to avoid crash
if the caller tries to print the error message.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r c19e32176690 -r 393e3ca97795 eo_parser_xml.c
--- a/eo_parser_xml.c	Wed Feb 13 07:45:33 2008 -0800
+++ b/eo_parser_xml.c	Thu Feb 21 07:44:01 2008 -0800
@@ -327,7 +327,7 @@ static CMPIStatus parse_instance(const C
 {
         char *class = NULL;
         xmlNode *child;
-        CMPIStatus s;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIObjectPath *op;
 
         if (root->type != XML_ELEMENT_NODE) {
@@ -360,12 +360,18 @@ static CMPIStatus parse_instance(const C
         op = CMNewObjectPath(broker, ns, class, &s);
         if ((op == NULL) || (s.rc != CMPI_RC_OK)) {
                 CU_DEBUG("Unable to create path for %s:%s", ns, class);
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to create path for %s:%s", ns, class);
                 goto out;
         }
 
         *inst = CMNewInstance(broker, op, &s);
         if ((*inst == NULL) || (s.rc != CMPI_RC_OK)) {
                 CU_DEBUG("Unable to create inst for %s:%s", ns, class);
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to create instance for %s:%s", ns, class);
                 goto out;
         }
 




More information about the Libvirt-cim mailing list