diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-02-26 14:10:27 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-02-26 14:10:27 +0000 |
commit | 54ace44f26dab8031c5bb757158e1d984d3ccefe (patch) | |
tree | d544690488173c8a37a8afd9625a33acefc805ee /xserver/record/record.c | |
parent | 97c9585d2250d41503f4b492c6a66da80462aaad (diff) |
record: Fix undefined memcpy in RecordAClientStateChange
From Adam Jackson
f44ac101c523a0439bd1a864850e3c1a4e154549 in xserver git
avoids a large number of malloc(0) calls
ok deraadt@ who had almost the same diff
Diffstat (limited to 'xserver/record/record.c')
-rw-r--r-- | xserver/record/record.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xserver/record/record.c b/xserver/record/record.c index 05d751ac2..e4b97c18c 100644 --- a/xserver/record/record.c +++ b/xserver/record/record.c @@ -2728,7 +2728,8 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata, case ClientStateRetained: /* client disconnected */ /* RecordDisableContext modifies contents of ppAllContexts. */ - numContextsCopy = numContexts; + if (!(numContextsCopy = numContexts)) + break; ppAllContextsCopy = xallocarray(numContextsCopy, sizeof(RecordContextPtr)); assert(ppAllContextsCopy); |