Question on lp_load() and smb_iconv_open()

Brad Hards bradh at frogmouth.net
Thu May 1 11:59:46 GMT 2008


On Thursday 01 May 2008 09:42:24 pm Jelmer Vernooij wrote:
> On Thu, 2008-05-01 at 15:03 +0400, Alexander Bokovoy wrote:
> > 2008/5/1, Brad Hards <bradh at frogmouth.net>:
> > > source/param/loadparm.c, line 2477 (in lp_load()) calls
> > > smb_iconv_open() (in lib/charset/iconv.c). That ends up calling the
> > > system iconv_open().
> > >
> > >  There is a smb_iconv_close() function (which calls the system
> > > iconv_close()) to clean up. However loadparm.c doesn't appear to call
> > > it. It doesn't even store the
> > >
> > >  I'm not sure how to fix this. The easiest way would appear to be some
> > > kind of lp_unload() that gets the smb_iconv_t back from the
> > > lib/util/dprintf.c static variable, and then calls smb_iconv_close().
> > >
> > >  Comments, suggestions, or patches most welcome...
> >
> > What about allocating it on some global context and set destructor to
> > that structure to call smb_iconv_close()? This way it will be closed
> > automatically when global context is destroyed.
>
> This is the iconv handle used by DEBUG. Deallocating it could have
> strange side-effects.. Ideally, lp_load() should not be touching any
> global state.
>
> Generally, an application should only be calling lp_load() once and the
> iconv context set then will live until the end of the process. Is there
> a particular reason this variable is a problem atm?
It isn't really a problem, just an annoyance in the "still reachable" valgrind
output. On my machine, it is ~32K across four "loss records". 

It would be nice if I could see the difference between real bugs in openchange
code, and artifacts from samba4.

FWIW, the next biggest issue is in the sasl init code, which I can't see how to
fix either. There are a range of different paths, with this as the common 
element:
==18655==    by 0x313F008AD1: sasl_client_init (in /usr/lib64/libsasl2.so.2.0.22)
==18655==    by 0x4FC7528: gensec_sasl_init (cyrus_sasl.c:384)
==18655==    by 0x5312910: run_init_functions (util.c:251)
==18655==    by 0x52E4C97: gensec_init (gensec.c:1280)
==18655==    by 0x4F64402: dcerpc_init (dcerpc.c:36)
==18655==    by 0x4C45420: MAPIInitialize (cdo_mapi.c:213)
==18655==    by 0x402D3B: main (mapitest.c:133)







More information about the samba-technical mailing list