On Mon, Oct 03, 2022 at 06:47:32PM +0800, Po Lu wrote:
> Po Lu <luang...@yahoo.com> writes:
> 
> > ==67186== 408 bytes in 1 blocks are definitely lost in loss record 272 of 
> > 344
> > ==67186==    at 0x484A464: calloc (vg_replace_malloc.c:1328)
> > ==67186==    by 0x490935F: _XimOpenIM (in /usr/lib64/libX11.so.6.4.0)
> > ==67186==    by 0x490F386: _XimRegisterIMInstantiateCallback (in 
> > /usr/lib64/libX11.so.6.4.0)
> > ==67186==    by 0x48FBDBD: XRegisterIMInstantiateCallback (in 
> > /usr/lib64/libX11.so.6.4.0)
> > ==67186==    by 0x4456B5: tiInitTextInput (text_input.c:837)
> > ==67186==    by 0x4079C5: dlMain (loader.c:205)
> > ==67186==    by 0x4079F2: main (loader.c:214)
> 
> diff --git a/modules/im/ximcp/imInsClbk.c b/modules/im/ximcp/imInsClbk.c
> index 95b379cb..c10e347f 100644
> --- a/modules/im/ximcp/imInsClbk.c
> +++ b/modules/im/ximcp/imInsClbk.c
> @@ -212,6 +212,9 @@ _XimRegisterIMInstantiateCallback(
>      if( xim ) {
>       lock = True;
>       xim->methods->close( (XIM)xim );
> +     /* XIMs must be freed manually after being opened; close just
> +        does the protocol to deinitialize the IM.  */
> +     XFree( xim );

looks okay reading the library code (src/xlibi18n/XDefaultIMIF.c, _CloseIM).

xterm doesn't free that 'xim' value (and the XCloseIM manual page doesn't
say who's responsible for that -- though it's possible that some other
application developer read the library source code and is freeing it).

>       lock = False;
>       icb->call = True;
>       callback( display, client_data, NULL );
> 
> Does this seem right?

-- 
Thomas E. Dickey <dic...@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to