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
1 changed files with 2 additions and 1 deletions

View File

@ -2729,7 +2729,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);