Red Hat Bugzilla – Bug 171053
Memory Leak in XmGetVisibility Function
Last modified: 2007-11-30 17:07:08 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921 Red Hat/1.7.12-1.4.1
Description of problem:
Note: This bug is also present on Red Hat Enterprise Linux version 4 in the openmotif21-2.1.30-11.RHEL4.4 package.
There exists a bug in OpenMotif 2.1.30 in the XmGetVisibility method, the list of children returned by XQueryTree() function is not free'd. This bug has been identified and fixed in the Imperial Software Technologies version of OpenMotif 2.1.31. Here is a link to their 2.1.31 release notes document:
Notice the description of the bug under the Traversal.c file.
Their fix to Traversal.c on line 1541 involves simply calling XFree((Window*)children); before returning from the XmGetVisibility() function.
This bug causes a series memory leak in our application, and I would imagine any that calls the XtSetValues function in order to update the resources behind a Motif widget.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Write a motif GUI application that updates the resource value of a Motif widget about once per second using the XtSetValues() function.
2. Execute said application.
Actual Results: Memory leaks from the XmGetVisibility() function.
Here is the output from Valgrind showing the offending call stack (Notice that this function has leaked 32868 bytes in only 10 invocations.):
==359== 32868 bytes in 83 blocks are definitely lost in loss record 143 of 146
==359== at 0x1B8FF88D: malloc (vg_replace_malloc.c:149)
==359== by 0x1BBDB374: XQueryTree (in /usr/X11R6/lib/libX11.so.6.2)
==359== by 0x1BAB9413: XmGetVisibility (in /usr/X11R6/lib/libXm.so.2.1)
==359== by 0x1BAB96B2: (within /usr/X11R6/lib/libXm.so.2.1)
==359== by 0x1BABA588: _XmNavigSetValues (in /usr/X11R6/lib/libXm.so.2.1)
==359== by 0x1BAB60D0: (within /usr/X11R6/lib/libXm.so.2.1)
==359== by 0x1BB8F6A4: (within /usr/X11R6/lib/libXt.so.6.0)
==359== by 0x1BB8F660: (within /usr/X11R6/lib/libXt.so.6.0)
==359== by 0x1BB8FAB2: XtSetValues (in /usr/X11R6/lib/libXt.so.6.0)
==359== by 0x1BBA27AE: XtVaSetValues (in /usr/X11R6/lib/libXt.so.6.0)
==359== by 0x804A5ED: update_page (dsp_mnepage.c:917)
==359== by 0x1BB85752: (within /usr/X11R6/lib/libXt.so.6.0)
Expected Results: The list of children returned by the call to XQueryTree() should be free'd; thereby, eliminating the memory leak.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.