record: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
85eefbf721
commit
2263e514c4
|
@ -2689,7 +2689,6 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
|
||||||
NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
|
NewClientInfoRec *pci = (NewClientInfoRec *) calldata;
|
||||||
int i;
|
int i;
|
||||||
ClientPtr pClient = pci->client;
|
ClientPtr pClient = pci->client;
|
||||||
RecordContextPtr *ppAllContextsCopy = NULL;
|
|
||||||
int numContextsCopy = 0;
|
int numContextsCopy = 0;
|
||||||
|
|
||||||
switch (pClient->clientState) {
|
switch (pClient->clientState) {
|
||||||
|
@ -2714,8 +2713,9 @@ RecordAClientStateChange(CallbackListPtr *pcbl, void *nulldata,
|
||||||
/* RecordDisableContext modifies contents of ppAllContexts. */
|
/* RecordDisableContext modifies contents of ppAllContexts. */
|
||||||
if (!(numContextsCopy = numContexts))
|
if (!(numContextsCopy = numContexts))
|
||||||
break;
|
break;
|
||||||
ppAllContextsCopy = calloc(numContextsCopy, sizeof(RecordContextPtr));
|
RecordContextPtr *ppAllContextsCopy = calloc(numContextsCopy, sizeof(RecordContextPtr));
|
||||||
assert(ppAllContextsCopy);
|
if (!ppAllContextsCopy)
|
||||||
|
return;
|
||||||
memcpy(ppAllContextsCopy, ppAllContexts,
|
memcpy(ppAllContextsCopy, ppAllContexts,
|
||||||
numContextsCopy * sizeof(RecordContextPtr));
|
numContextsCopy * sizeof(RecordContextPtr));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue