Should XtCallbackReleaseCacheRefList free its argument?
In the libXt spec, starting at https://gitlab.freedesktop.org/xorg/lib/libxt/-/blob/master/specs/CH09.xml#L2919 XtCallbackReleaseCacheRefList()
is defined as a way to "explicitly decrement reference counts", but the current implementation also tries to free the list it's given:
https://gitlab.freedesktop.org/xorg/lib/libxt/-/blob/1aaf5d502027104ddd566090787780319f510278/src/Convert.c#L1106-1114
For nearly two decades now, we've been carrying around a change in the Solaris libXt that removes the free statement:
https://github.com/oracle/solaris-userland/blob/f82e11f/components/x11/lib/libXt/patches/05-15143893.patch
Unfortunately, the original author left the company long ago, but in our internal bug database, it appears this came up when submitting VSW5 results for certification to The Open Group, and getting a segfault in the XtCallbackReleaseCacheRefList()
test because it had allocated the list on the stack, not with malloc()
. It appears we were told then this was a bug in our implementation and that the function should not be freeing the list. (It's unclear why this change never got reported/fixed in the X.Org upstream code if this is the case, as the free has been there since the function was created: alanc/xc-historical@540552e8)
After the VSW test suite was open sourced as XTS, the test was changed to workaround this issue: xorg/test/xts@c3a401f8
I'm not clear on which view was correct - was the test wrong or is the current libXt code wrong?