record: protect from memory allocation failure

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-24 14:22:46 +01:00
parent 7b24948dbf
commit 953f0a68dc

View File

@ -2712,7 +2712,8 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
/* RecordDisableContext modifies contents of ppAllContexts. */
if (!(numContextsCopy = numContexts))
break;
ppAllContextsCopy = calloc(numContextsCopy, sizeof(RecordContextPtr));
if (!(ppAllContextsCopy = calloc(numContextsCopy, sizeof(RecordContextPtr))))
return;
assert(ppAllContextsCopy);
memcpy(ppAllContextsCopy, ppAllContexts,
numContextsCopy * sizeof(RecordContextPtr));