Get rid of unchecked calls to malloc

This commit is contained in:
Vladimir Olteanu 2021-07-12 03:25:59 +03:00 committed by Anders Jenbo
commit 7271e5558c
4 changed files with 8 additions and 2 deletions

View file

@ -81,6 +81,8 @@ void dthread_send_delta(int pnum, _cmd_id cmd, byte *pbSrc, int dwLen)
}
pkt = static_cast<TMegaPkt *>(std::malloc(dwLen + 20));
if (pkt == nullptr)
app_fatal("Failed to allocate memory");
pkt->pNext = nullptr;
pkt->dwSpaceLeft = pnum;
pkt->data[0] = static_cast<byte>(cmd);