From fa61f8a21677fe73298d2cf6ae80db17e4e132ab Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 27 Jun 2025 17:12:56 +0200 Subject: [PATCH] Fix a memory leak with UTF-8 strings Resolves: RHEL-100816 --- 0001-Xm-String-Fix-memory-leak.patch | 28 ++++++++++++++++++++++++++++ motif.spec | 10 +++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0001-Xm-String-Fix-memory-leak.patch diff --git a/0001-Xm-String-Fix-memory-leak.patch b/0001-Xm-String-Fix-memory-leak.patch new file mode 100644 index 0000000..45a9143 --- /dev/null +++ b/0001-Xm-String-Fix-memory-leak.patch @@ -0,0 +1,28 @@ +From 30ff6e00e9a5edc15ff438b6cfd8a5a4169630a1 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Mon, 16 Jun 2025 14:49:55 +0200 +Subject: [PATCH] Xm/String: Fix memory leak + +ComputeMetrics() would leak the string created by _XmUtf8ToUcs2(), make +sure to free the string once done with it. + +Signed-off-by: Olivier Fourdan +--- + lib/Xm/XmString.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/Xm/XmString.c b/lib/Xm/XmString.c +index 2c54ef57..6ee1c40e 100644 +--- a/lib/Xm/XmString.c ++++ b/lib/Xm/XmString.c +@@ -6272,6 +6272,7 @@ ComputeMetrics(XmRendition rend, + + XTextExtents16(font_struct, str, str_len, + &dir, &asc, &desc, &char_ret); ++ XFree(str); + } else + XTextExtents16(font_struct, + (XChar2b *)text, Half(byte_count), +-- +2.50.0 + diff --git a/motif.spec b/motif.spec index 0e33091..8f53ec7 100644 --- a/motif.spec +++ b/motif.spec @@ -1,7 +1,7 @@ Summary: Run-time libraries and programs Name: motif Version: 2.3.4 -Release: 30%{?dist} +Release: 31%{?dist} License: LGPLv2+ Source: http://downloads.sf.net/motif/motif-%{version}-src.tgz Source1: xmbind @@ -56,6 +56,9 @@ Patch62: 0005-Xm-RCMenu-Use-Xinerama-for-placement.patch Patch63: 0006-Xm-Tooltip-Use-Xinerama-for-placement.patch Patch64: 0007-Xm-ComboBox-Use-Xinerama-for-placement.patch +# https://issues.redhat.com/browse/RHEL-100816 +Patch65: 0001-Xm-String-Fix-memory-leak.patch + Conflicts: lesstif <= 0.92.32-6 %description @@ -110,6 +113,7 @@ This package contains the static Motif libraries. %patch62 -p1 -b .xinerama %patch63 -p1 -b .xinerama %patch64 -p1 -b .xinerama +%patch65 -p1 -b .memleak %build ./autogen.sh @@ -159,6 +163,10 @@ rm -f %{buildroot}%{_libdir}/*.la %{_libdir}/lib*.a %changelog +* Fri Jun 27 2025 Olivier Fourdan - 2.3.4-31 +- Fix a memory leak with UTF-8 strings + Resolves: RHEL-100816 + * Mon Jun 2 2025 Olivier Fourdan - 2.3.4-30 - Keep drop-down menus on the same monitor as the pull-down button with Xinerama