summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-31 09:35:02 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-31 09:35:02 -0700
commitaa2c405f348b07ba2a1c02ca0ca5e2799a6a102e (patch)
tree6ac412077a3935ea84bba81d90349d2a92fb4ee8
parent31b838d61caea9e8b1dd5dcf09c22c4b39131717 (diff)
SequencedReplyExpected: stop leaking memory if server fd not foundHEADmaster
Reported by Oracle Parfait 16.2: Error: Memory leak Memory leak [memory-leak]: Memory leak of pointer p allocated with NewQEntry(...) at line 203 of decode11.c in function 'SequencedReplyExpected'. malloc called at line 106 in function 'NewQEntry' Allocated value returned to caller at line 121 p allocated at line 198 in function 'SequencedReplyExpected' with NewQEntry(...) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xscope/-/merge_requests/18>
-rw-r--r--decode11.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/decode11.c b/decode11.c
index 7243605..5785360 100644
--- a/decode11.c
+++ b/decode11.c
@@ -194,14 +194,15 @@ SequencedReplyExpected(FD fd, long SequenceNumber,
debug(8, (stderr,
"Reply expected: sequence %ld and request type %d,%d for fd %d\n",
SequenceNumber, RequestType, RequestMinorType, fd));
- /* create a new queue entry */
- p = NewQEntry(SequenceNumber, RequestType, RequestMinorType);
/* find the server associated with this client */
fd = FDPair(fd);
if (fd < 0 || fd >= MaxFD)
return;
+ /* create a new queue entry */
+ p = NewQEntry(SequenceNumber, RequestType, RequestMinorType);
+
/* attach the new queue entry to the end of the queue for the Server */
if (ReplyQ[fd].Tail != NULL)
(ReplyQ[fd].Tail)->Next = p;