From f44ac101c523a0439bd1a864850e3c1a4e154549 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 15 Oct 2019 13:21:37 -0400 Subject: [PATCH] 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. --- record/record.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/record/record.c b/record/record.c index 3a1b005163..757fde1fed 100644 --- a/record/record.c +++ b/record/record.c @@ -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);