dix: avoid memory leak in ProcListProperties()

Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../dix/property.c:584:5:
 warning[-Wanalyzer-malloc-leak]: leak of ‘pAtoms’

Can happen if, and only if, XaceHookPropertyAccess() blocks access
to all properties, so that numProps ends up zero on the second loop.

Fixes: 39f337fd4 ("dix: ProcListProperties: skip unneeded work if numProps is 0")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit ed92eae84d)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2076>
This commit is contained in:
Alan Coopersmith 2025-10-12 14:04:53 -07:00 committed by Olivier Fourdan
parent cdf3045f3f
commit 88480435c2

View file

@ -616,8 +616,8 @@ ProcListProperties(ClientPtr client)
if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
free(pAtoms);
}
free(pAtoms);
return Success;
}