Question on lp_load() and smb_iconv_open()

Jelmer Vernooij jelmer at
Thu May 1 11:42:24 GMT 2008

On Thu, 2008-05-01 at 15:03 +0400, Alexander Bokovoy wrote:
> 2008/5/1, Brad Hards <bradh at>:
> > 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?



Jelmer Vernooij <jelmer at> -

More information about the samba-technical mailing list