[omniORB] Memory leak in OmniORB version 4.0.1

Luke Deller ldeller at xplantechnology.com
Sat Feb 3 21:46:33 GMT 2007


Hi Jasjirat,

Your code leaks the CORBA::Object_ptr returned by
servant_to_reference(servant).  This kind of problem can be avoided by
using the relevant _var convenience class to handle its cleanup, eg:
       CORBA::Object_var obj = poa->servant_to_reference(servant);

BTW I don't think you actually need to call servant_to_reference... it
looks like you can call _mostDerivedRepoId() on the servant:
       servant->_mostDerivedRepoId();

This is omniORB specific, but so is the use of _PR_getobj() in the code
which you proposed.  The standard-compliant way to do this would be to
call _get_interface() on the servant, but that requires the use of an
interface repository which is not built into omniORB.

Regards,
Luke.
**********************************************************************************************
Important Note
This email (including any attachments) contains information which is confidential and may be subject to legal privilege.  If you are not the intended recipient you must not use, distribute or copy this email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this email are not necessarily the views of XPlan Technology.

It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system.
Xplan Technology does not warrant that the information is free of a virus or any other defect or error.
**********************************************************************************************



More information about the omniORB-list mailing list