From ed92eae84d4a9e0985e1ac883089d4d68a679bb0 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 12 Oct 2025 14:04:53 -0700 Subject: [PATCH] dix: avoid memory leak in ProcListProperties() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- dix/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/property.c b/dix/property.c index e5e579f95..93cd3fcc1 100644 --- a/dix/property.c +++ b/dix/property.c @@ -618,8 +618,8 @@ ProcListProperties(ClientPtr client) if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); - free(pAtoms); } + free(pAtoms); return Success; }