Fix OOM situation
This commit is contained in:
parent
9c18ae5bee
commit
0376dcd065
@ -1056,11 +1056,9 @@ rdpMcs* mcs_new(rdpTransport* transport)
|
||||
{
|
||||
rdpMcs* mcs;
|
||||
|
||||
mcs = (rdpMcs*) malloc(sizeof(rdpMcs));
|
||||
|
||||
if (mcs)
|
||||
{
|
||||
ZeroMemory(mcs, sizeof(rdpMcs));
|
||||
mcs = (rdpMcs *)calloc(1, sizeof(rdpMcs));
|
||||
if (!mcs)
|
||||
return NULL;
|
||||
|
||||
mcs->transport = transport;
|
||||
mcs->settings = transport->settings;
|
||||
@ -1073,9 +1071,14 @@ rdpMcs* mcs_new(rdpTransport* transport)
|
||||
mcs->channelCount = 0;
|
||||
mcs->channelMaxCount = CHANNEL_MAX_COUNT;
|
||||
mcs->channels = (rdpMcsChannel *)calloc(mcs->channelMaxCount, sizeof(rdpMcsChannel));
|
||||
}
|
||||
if (!mcs->channels)
|
||||
goto out_free;
|
||||
|
||||
return mcs;
|
||||
|
||||
out_free:
|
||||
free(mcs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user