[Libvirt-cim] [PATCH 2 of 3] SDC: returned instances are not of type specific subclass

Dan Smith danms at us.ibm.com
Fri Dec 14 14:42:59 UTC 2007


HE> +        if (rasd_classname_from_type(rasd->resource_type, &base) != CMPI_RC_OK) {
HE> +                cu_statusf(broker, s, 
HE> +                           CMPI_RC_ERR_FAILED,
HE> +                           "Resource type not known");
HE> +                goto err;
HE> +        }
HE> +
HE>          inst = get_typed_instance(broker,
HE>                                    CLASSNAME(ref),
HE> -                                  "ResourceAllocationSettingData",
HE> +                                  base,
HE>                                    NAMESPACE(ref));
         
HE>          CMSetProperty(inst, "InstanceID", inst_id, CMPI_chars);
HE> @@ -723,6 +732,7 @@ static CMPIInstance *sdc_rasd_inst(const
HE>                                prop_list[i].value, prop_list[i].type);
HE>          }

HE> + err:
HE>          CU_DEBUG("freeing prop_list");
HE>          free_rasd_prop_list(prop_list);
HE>   out:

I didn't notice this before, but shouldn't we initialize prop_list to
NULL, make sure free_rasd_prop_list() can handle NULL, and then put
the free call below the out: target?  There is another place in the
function that looks like it jumps to out after prop_list could have
been initialized.  Further, it would be better to have it below out,
so that additions like this one don't have to add or utilize an err:
target.

Heidi, I know this isn't really a part of your patch, but I think it's
worth looking at while we're here.

Jay, can you comment?

Thanks!

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071214/920fa56d/attachment.sig>


More information about the Libvirt-cim mailing list