diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-10-04 18:26:17 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-10-04 19:03:48 -0400 |
commit | 1d11822601fd24a396b354fa616b04ed3df8b4ef (patch) | |
tree | 944bb7985731e495c996eef0f185b5f0b3894b59 | |
parent | 1f8fd7ff1cf688ec1d3b34397c6d58110bb0cae5 (diff) |
fix a memory leak in XRegisterIMInstantiateCallback
Analysis:
_XimRegisterIMInstantiateCallback() opens an XIM and closes it using
the internal function pointers, but the internal close function does
not free the pointer to the XIM (this would be done in XCloseIM()).
Report/patch:
Date: Mon, 03 Oct 2022 18:47:32 +0800
From: Po Lu <luangruo@yahoo.com>
To: xorg-devel@lists.x.org
Subject: Re: Yet another leak in Xlib
For reference, here's how I'm calling XRegisterIMInstantiateCallback:
XSetLocaleModifiers ("");
XRegisterIMInstantiateCallback (compositor.display,
XrmGetDatabase (compositor.display),
(char *) compositor.resource_name,
(char *) compositor.app_name,
IMInstantiateCallback, NULL);
and XMODIFIERS is:
@im=ibus
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r-- | modules/im/ximcp/imInsClbk.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 ); lock = False; icb->call = True; callback( display, client_data, NULL ); |