[omniORB] slight memory leak in 2.5.0

Mark Little M.C.Little@ncl.ac.uk
Fri, 27 Mar 1998 12:10:24 +0000


There appears to be a possibility of a slight memory leak (1 byte per
call) in the 2.5.0 release of omniORB2. Its shown up in Solaris 2.6 by
purify. Purify flags the following:

case 1:
      id = new CORBA::Char[1]; <<<< this line is the memory leak
      id[0] <<= s;
      if (id[0] != (CORBA::Char)'\0')
	throw CORBA::MARSHAL(0,CORBA::COMPLETED_MAYBE);
      idlen = 0;
      break;

It's in objectRef.cc  UnMarshalObjRef. In the switch statement a
character array is created with varying size. I haven't spent much time
tracking it down but it appears to be the following. For the 'case 1'
the array is a single byte (id = new CORBA::Char[1];) and idlen may also
be set to 0. The code then "drops" though to the following:

 if (profiles->length() == 0 && idlen == 0) {
      // This is a nil object reference
      delete profiles;
      profiles = 0;
      return CORBA::Object::_nil();
    }

And the byte array is never deleted.

Mark.

-----------------------------------------------------------------------
SENDER : Dr. Mark Little, Arjuna Project, Distributed Systems Research.
PHONE  : +44 191 222 8066, FAX : +44 191 222 8232
POST   : Department of Computing Science, University of Newcastle upon
	 Tyne, UK, NE1 7RU
EMAIL  : M.C.Little@newcastle.ac.uk