record: Fix undefined memcpy in RecordAClientStateChange

If we don't have any recording contexts just skip all this. Note this
also skips a pointless trip through malloc(0)/free.
This commit is contained in:
Adam Jackson 2019-10-15 13:21:37 -04:00
parent 9155e0c7c6
commit f44ac101c5

View File

@ -2729,7 +2729,8 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
case ClientStateRetained: /* client disconnected */ case ClientStateRetained: /* client disconnected */
/* RecordDisableContext modifies contents of ppAllContexts. */ /* RecordDisableContext modifies contents of ppAllContexts. */
numContextsCopy = numContexts; if (!(numContextsCopy = numContexts))
break;
ppAllContextsCopy = xallocarray(numContextsCopy, ppAllContextsCopy = xallocarray(numContextsCopy,
sizeof(RecordContextPtr)); sizeof(RecordContextPtr));
assert(ppAllContextsCopy); assert(ppAllContextsCopy);