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

Heidi Eckhart heidieck at linux.vnet.ibm.com
Thu Dec 13 11:17:23 UTC 2007


Jay Gagnon wrote:
> Kaitlin Rupert wrote:
>   
>> Heidi Eckhart wrote:
>>     
>>>        +        if (base)
>>> +                inst = get_typed_instance(broker,
>>> +                                          CLASSNAME(ref),
>>> +                                          base,
>>> +                                          NAMESPACE(ref));
>>>                   CMSetProperty(inst, "InstanceID", inst_id,
>>> CMPI_chars);
>>>          CMSetProperty(inst, "PropertyPolicy", &policy, CMPI_uint16);
>>>   
>>>       
>> Should there be an else statement here?  If the if statement fails,
>> then an instance isn't created.  CMSetProperty() would be trying to
>> get the value of a NULL inst, which would most likely fail.
>>
>>     
> Seems like a good idea to me.  Just something simple that sets status as
> appropriate and bails is all that should be necessary there.
Thanks for this very good catch :).
I have added a default phrase to the switch statement for resource_type, 
that returns an error in case of an unknown resource type and exits 
right afterwards.

-- 
Regards

Heidi Eckhart
Software Engineer
Linux Technology Center - Open Hypervisor

heidieck at linux.vnet.ibm.com

**************************************************
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the Libvirt-cim mailing list