[omniORB] CORBA SSL: Control over sslContext allocation and destruction?

Daniel Krügler daniel.kruegler at gmail.com
Sat Feb 17 12:56:06 UTC 2024


Hi,

I studied the documentation of how to initialize an sslContext
instance. After having done this, I'm wondering, whether the following
approach would be valid code:

sslContext* myContext = my_new(); // Not necessarily by new
sslContext.singleton = myContext;
CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);
sslContext.singleton = 0; // #1
[...]
orb->destroy(); // #2
my_delete(myContext); // Not necessarily by delete

my_new and my_delete are placeholders for my own allocation and
construction, and deallocation and destruction functions,
respectively, (Possibly even without involving new or delete, for
example by using an instance of static storage duration instead or by
using completely different free store functions which are not
necessarily compatible with new and delete).

By means of line #1 I want to prevent that at line #2 the
sslContext.singleton becomes destroyed using delete (potentially using
the incorrect deallocation form).

The above model depends on whether it is guaranteed that the initialization

new sslTransportImpl(sslContext::singleton)

(sslTransportImpl.cc, line 514) has completed *before* ORB_init has
completed and that the destruction

if (sslContext::singleton) delete sslContext::singleton;

(sslTransportImpl.cc, line 521) is guaranteed to happen within
orb->destroy() (or at least not after it).

Thanks for your help,

- Daniel



More information about the omniORB-list mailing list