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

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1203540299 28800 # Node ID ff79f3c78309209c682bad229cde371ebeef2576 # 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@us.ibm.com> diff -r c19e32176690 -r ff79f3c78309 eo_parser_xml.c --- a/eo_parser_xml.c Wed Feb 13 07:45:33 2008 -0800 +++ b/eo_parser_xml.c Wed Feb 20 12:44:59 2008 -0800 @@ -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; } @@ -380,6 +386,10 @@ static CMPIStatus parse_instance(const C CU_DEBUG("Unexpected node: %s\n", child->name); } } + + cu_statusf(broker, &s, + CMPI_RC_OK, + ""); out: free(class);

Dan Smith wrote:
@@ -380,6 +386,10 @@ static CMPIStatus parse_instance(const C CU_DEBUG("Unexpected node: %s\n", child->name); } }
Maybe you can define CMPIStatus s = {CMPI_RC_OK, ""}; instead of setting it later. The result would be the same.
+ + cu_statusf(broker, &s, + CMPI_RC_OK, + "");
out: free(class);
Other than that ... makes sense and applies fine ... +1. -- Regards Heidi Eckhart Software Engineer IBM Linux Technology Center - Open Hypervisor

HE> Maybe you can define CMPIStatus s = {CMPI_RC_OK, ""}; instead of HE> setting it later. The result would be the same. That was pretty silly of me. I'll resend :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Heidi Eckhart