-
Bug
-
Resolution: Done-Errata
-
Undefined
-
rhel-8.6.0
-
motif-2.3.4-23.el8_10
-
No
-
Moderate
-
1
-
rhel-display-window-mgmt
-
2
-
Dev ack
-
False
-
False
-
-
None
-
Display WM #2/2025
-
Pass
-
RegressionOnly
-
Unspecified
-
Unspecified
-
Unspecified
-
-
x86_64
-
None
Hi, all
One of the customer found that in _XmUtf8ToUcs2, memory is allocated (XtMalloc) for the string area to be returned as the _XmUtf8ToUcs2 return value, but there is no processing to release the memory corresponding to that memory allocation, resulting in a memory leak.
XmString.c: A memory leak occurs because the local variable str obtained by _XmUtf8ToUcs2 is not released by XFree:
~~~
static void
ComputeMetrics(XmRendition rend,
XtPointer text,
unsigned int byte_count,
XmTextType type,
int which_seg,
Dimension *width,
Dimension *height,
Dimension *ascent,
Dimension *descent,
Boolean utf8)
{
Dimension wid, hi;
int dir, asc, desc;
……
if (utf8)
else
~~~
Here is the Valgrind output:
~~~
==3692== 21,320 bytes in 4,030 blocks are definitely lost in loss record 892 of 898
==3692== at 0x4C37135: malloc (vg_replace_malloc.c:381)
==3692== by 0x5DD6ED8: XtMalloc (in /usr/lib64/libXt.so.6.0.0)
==3692== by 0x5A8B6B8: _XmUtf8ToUcs2 (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x5A2B669: ??? (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x5A33B94: ??? (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x5A37C10: ??? (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x5A3803A: ??? (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x5A387FD: XmStringDraw (in /usr/lib64/libXm.so.4.0.4)
==3692== by 0x507BF1E: CXmString::Draw(_XDisplay*, unsigned long, CXmFontList&, _XGC*, short, short, char*) (CXmString.cpp:138)
==3692== by 0x56D8CFB: ScaleTickDraw::Draw(unsigned long, int, int, int, int, char const*, int) (ScaleTickDraw.cpp:157)
==3692== by 0x56D99EB: ScaleTickFreqR::Draw(unsigned long, int, int, int, int, int, GramFrame*) (ScaleTickFreqR.cpp:156)
==3692== by 0x56D603D: GramFrame::DrawFrame(_XDisplay*, _XGC*, unsigned long) (GramFrame.cpp:152)
~~~
By the way, in the latest RHEL 8.10 and RHEL 9.6, there is still no ‘XFree’ under this function from what I found.
Thank you.
- links to
-
RHBA-2025:150612 motif bug fix update