On December 3, 2004 07:30 pm, Dr. Stephen Henson wrote:
> On Fri, Dec 03, 2004, Dmitry Belyavsky wrote:
> > On Fri, 3 Dec 2004, Dmitry Belyavsky wrote:
> > > I have custom dynamically-loaded engine implementing some
> > > non-standard algorithms. So I register NIDs using OBJ_create from
> > > engine bind function. Registering code looks like
> > >
> > >  my_NID = OBJ_create("1.2.3.4.5","OID_example","Our example OID");
> > >
> > > On unload I get segfault in apps_shutdown. It happens in
> > > OBJ_NAME_cleanup. It looks like OBJ_NAME_cleanup tries to free
> > > memory belongs to unloaded library.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ahh.

> > >
> > > What should I do to avoid this?
> >
> > I found out segfault happens because function registered as
> > ENGINE_set_destroy_function is never called. When it is called (for
> > example, when I use engine only to calc digest), there are some
> > memory leaks looks like they are because of registering objects.
>
> I hacked up a quick dynamic engine that called OBJ_create() only and I
> couldn't reproduce this. I used the autoconfig mechanism mentioned in
> config(5) to load it. The object was added, it was recognized by
> asn1parse and there were no leaks on shutdown.
>
> Are you calling OBJ_cleanup() for example in the dynamic engine?

This is probably another "global state"-type problem between the loader 
and loadee. See IMPLEMENT_DYNAMIC_BIND_FN() in engine.h for an peek into 
the horror. I'm guessing you guys are using different platforms, or at 
least different methods of compilation/linking? We need to ensure that 
the loaded engine use the loading app/lib's state - if necessary by 
redirecting its OBJ functionality to that of the loader.

I'm out of here for the weekend, but if noone gets to the bottom of this 
before middle(ish) of next week, I'll take a nosey. Which version are you 
using BTW?

Cheers,
Geoff

-- 
Geoff Thorpe
[EMAIL PROTECTED]
http://www.geoffthorpe.net/

Greedy Genghis George, Guru of God and Guns.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to