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
This commit is contained in:
jsg
2021-02-26 14:10:26 +00:00
parent 9d1e1e287e
commit 589df0861f

View File

@@ -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);