[PATCH:libX11] Bug 93183: _XDefaultOpenIM memory leak in out-of-memory error path

Alan Coopersmith alan.coopersmith at oracle.com
Thu Dec 3 23:42:26 PST 2015


free(local_impart) since that's where the allocated memory is stored
immediately from the calloc call, instead of relying on the pointer
being copied into im->private, since that only happens after the call
to goto Error2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93183
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/xlibi18n/XDefaultIMIF.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xlibi18n/XDefaultIMIF.c b/src/xlibi18n/XDefaultIMIF.c
index 2eb52ae..e691e03 100644
--- a/src/xlibi18n/XDefaultIMIF.c
+++ b/src/xlibi18n/XDefaultIMIF.c
@@ -232,8 +232,8 @@ _XDefaultOpenIM(
 
     return (XIM)im;
 Error2 :
-    Xfree(im->private);
     Xfree(im->core.im_name);
+    Xfree(local_impart);
     Xfree(im);
     _XlcCloseConverter(ctom_conv);
     _XlcCloseConverter(ctow_conv);
-- 
2.6.1



More information about the xorg-devel mailing list