[Libvirt-cim] [PATCH 2 of 3] Add check in EAFP to ensure ref passed is an actual instance
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Fri Dec 21 15:56:10 UTC 2007
Dan Smith wrote:
> KR> - type = device_type_from_poolid(poolid);
> KR> + type = device_type_from_str(class_base_name(CLASSNAME(ref)));
>
> A couple things here. First, I think that we should be passing in the
> id, in case we need to do more specific checking in the future. We
> can check the classname of the ref separately.
We'll need to do the classname checking here because the bug is that you
can pass a Xen_MemoryPool class with "ProcessorPool/0" as the ID, which
isn't valid.
>
> Second, class_base_name() returns a strdup()'d string, so you leak
> that here.
>
Oh yes, good catch. Thanks. =)
I'll re-work this.
--
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com
More information about the Libvirt-cim
mailing list