Re: Does freeing a CMPIArray free the underlying objects?

Jim Marshall <[email protected]>
Newsgroups gmane.network.open-pegasus.general
Organization WBEM Solutions, Inc.
Message-ID <[email protected]>
Hwang, Johnny wrote:
>
> Hello all,
>
> I'm wondering that, when I do the following call:
>
> CMPIArray *ptr;
>
> ...
>
> ptr->ft->release(ptr);
>
> Where ptr is a CMPIArray of CMPI_instances, would the CMPI_instances 
> also be released, or would I have to release them manually?
>
> Thanks for the clarification,
>
> Johnny Hwang
>

Technically you shouldn't have to call release on anything unless you 
specifically call 'clone' on it. See section 3.1.6 of the 2.0 CMPI 
specification, here is the pertinent part (second paragraph)

"CMPI performs automatic release of all its encapsulated objects used 
and/or created during
an MI function invocation cycle, except for those structures that have 
been copied explicitly
by the MI using the clone() function."

So you do not *have* to call release on the array or its elements but 
doing so should not cause any issues either. Of course this is 
predicated on the fact that the array was created properly using the 
CMPIBrokerEnc.newArray function.

Jim
-- 
mail
Jim Marshall

Sr. Software Engineer
WS <http://ws-inc.com/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.