From: <ABH...@De...> - 2014-11-18 06:21:10
|
Dell Customer Communication Hi, We were analyzing memory leaks in our provider context when I hit upon the following function, I believe it is called through CMReturnInstance. static CMPIStatus __rft_returnInstance(const CMPIResult * result, const CMPIInstance * instance) //line number 237, result.c In this function, int size,isInst=isInstance(instance); NativeResult *r = (NativeResult*) result; int releaseInstance=0; ... if (r->qs) { ... if (r->qs->where) { ... instance= r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,r->qs->cop,r->qs->keys); releaseInstance=1; ... instance= r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,r->qs->cop,r->qs->keys); releaseInstance=1; ... if (r->legacy) { ... if(isInst) { v.inst = CMClone(instance,NULL); memLinkInstance(v.inst); [Abhirup] I guess we need to put releaseInstance = 1 here? } else v.inst = (CMPIInstance *) instance; rc=returnData(result, &v, CMPI_instance); if (releaseInstance) instance->ft->release((CMPIInstance*)instance); [Abhirup] If we don't make releaseInstance=1 as shown in the last comment and if r->qs is False, then this is a Dead Code (might be leading to memory leak as well??) _SFCB_RETURN(rc); ... if (releaseInstance) instance->ft->release((CMPIInstance*)instance); _SFCB_RETURN(st); Kindly share your thoughts on this. Regards, Abhirup Seal |