From 95046aaaeecb4e8301169860f4ccf01066bf03f3 Mon Sep 17 00:00:00 2001 From: Scott Ludwig Date: Sat, 4 Jun 2016 19:06:05 -0700 Subject: [PATCH] Use delete[] for arrays allocated with new[]. --- base/misc.cpp | 2 +- game/CutScene.cpp | 4 ++-- game/Ecom.cpp | 4 ++-- game/GameObjects.cpp | 12 ++++++------ game/Player.cpp | 1 + game/SimUI.cpp | 2 +- game/SocTransport.cpp | 4 ++-- game/TriggerActions.cpp | 2 +- game/Unit.cpp | 2 +- game/UnitGroupMgr.cpp | 10 +++++----- game/bitmap.cpp | 2 +- game/cachemgr.cpp | 4 ++-- game/filepdbreader.cpp | 2 +- game/fogmap.cpp | 2 +- game/game.cpp | 8 ++++---- game/hashtablecode.cpp | 4 ++-- game/memmgr.cpp | 8 ++++---- game/mempdbreader.cpp | 6 +++--- game/misc.cpp | 2 +- game/misccontrols.cpp | 2 +- game/missionlist.cpp | 4 ++-- game/soundmgr.cpp | 4 ++-- game/tbitmap.cpp | 14 +++++++------- game/terrainmap.cpp | 10 +++++----- game/tilemap.cpp | 8 ++++---- game/updatemap.cpp | 10 +++++----- mpshared/messages.cpp | 4 ++-- mpshared/messages.h | 6 +++--- 28 files changed, 72 insertions(+), 71 deletions(-) diff --git a/base/misc.cpp b/base/misc.cpp index ced873e..e65aa1e 100644 --- a/base/misc.cpp +++ b/base/misc.cpp @@ -54,7 +54,7 @@ const char *StringEncoder::QueryEncode(const char *s) { } *out = 0; const char *result = base::Format::ToString("%s", buf); - delete buf; + delete[] buf; return result; } diff --git a/game/CutScene.cpp b/game/CutScene.cpp index 07d6e65..f7b1545 100644 --- a/game/CutScene.cpp +++ b/game/CutScene.cpp @@ -212,7 +212,7 @@ void CutSceneForm::More() // Start from the break next time around m_pszText += pchBreak - pszT; - delete pszT; + delete[] pszT; } gpmfrmm->DrawFrame(false); } @@ -305,4 +305,4 @@ bool CutSceneForm::OnPenEvent(Event *pevt) return Form::OnPenEvent(pevt); } -} // namespace wi \ No newline at end of file +} // namespace wi diff --git a/game/Ecom.cpp b/game/Ecom.cpp index 0f2d6dc..7e7fab3 100644 --- a/game/Ecom.cpp +++ b/game/Ecom.cpp @@ -152,7 +152,7 @@ EcomForm::EcomForm() EcomForm::~EcomForm() { if (m_pszText != NULL) - delete m_pszText; + delete[] m_pszText; } bool EcomForm::DoModal(char *pszMessage, int *pnResult, Sfx sfxShow, Sfx sfxHide) @@ -217,7 +217,7 @@ void EcomForm::More() // Start from the break next time around m_pszNext += pchBreak - pszT; - delete pszT; + delete[] pszT; bool fMore = (*m_pszNext != 0); if (fMore) { diff --git a/game/GameObjects.cpp b/game/GameObjects.cpp index 58e09fc..be22658 100644 --- a/game/GameObjects.cpp +++ b/game/GameObjects.cpp @@ -1331,7 +1331,7 @@ bool GobMgr::Init(TCoord ctx, TCoord cty, int cpgobMax) int cbT = sizeof(Gob **) * (m_cpgobMax + 1); m_apgobMaster = (Gob **)gmmgr.AllocPtr(cbT); if (m_apgobMaster == NULL) { - delete apgobMaster; + delete[] apgobMaster; return false; } @@ -1350,7 +1350,7 @@ bool GobMgr::Init(TCoord ctx, TCoord cty, int cpgobMax) gmmgr.WritePtr(m_apgobMaster, 0, apgobMaster, cbT); m_ppgobFreeTail = m_apgobMaster + m_cpgobMax; m_ppgobFreeHead = m_apgobMaster; - delete apgobMaster; + delete[] apgobMaster; // Allocate gidMap @@ -1372,11 +1372,11 @@ bool GobMgr::Init(TCoord ctx, TCoord cty, int cpgobMax) cbT = m_ctx * m_cty * sizeof(Gid); m_pgidMap = (Gid *)gmmgr.AllocPtr(cbT); if (m_pgidMap == NULL) { - delete pgidMap; + delete[] pgidMap; return false; } gmmgr.WritePtr(m_pgidMap, 0, pgidMap, cbT); - delete pgidMap; + delete[] pgidMap; #ifdef INCL_VALIDATEHEAP gmmgr.Validate(); @@ -1958,7 +1958,7 @@ void GobMgr::AddGobToAreas(Gid gid, AreaMask am) par->aare = aare; } else { memcpy(aare, par->aare, ELEMENTSIZE(aare) * par->careAlloc); - delete par->aare; + delete[] par->aare; par->aare = aare; } @@ -2182,7 +2182,7 @@ bool GobMgr::LoadAreas(IniReader *pini) void GobMgr::FreeAreas() { for (int iar = 0; iar < m_car; iar++) { - delete m_aar[iar].aare; + delete[] m_aar[iar].aare; m_aar[iar].aare = NULL; } m_car = 0; diff --git a/game/Player.cpp b/game/Player.cpp index e337bd2..b3de965 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -16,6 +16,7 @@ Player gplrDummy; PlayerMgr::PlayerMgr() { + m_aplr = NULL; Reset(); } diff --git a/game/SimUI.cpp b/game/SimUI.cpp index a1177e7..288b615 100644 --- a/game/SimUI.cpp +++ b/game/SimUI.cpp @@ -775,7 +775,7 @@ void SimUIForm::OnTimer(long tCurrent) { memcpy(&pcc->amsgCommands, gcmdq.GetFirst(), cmsg * sizeof(Message)); gptra->SendNetMessage(pcc); - delete pcc; + delete[] pcc; } gcmdq.Clear(); } diff --git a/game/SocTransport.cpp b/game/SocTransport.cpp index f4c6ae8..7d3cdd6 100644 --- a/game/SocTransport.cpp +++ b/game/SocTransport.cpp @@ -687,7 +687,7 @@ bool SocConnection::Poll() if (cbT == SOCKET_ERROR) { int err = WSAGetLastError(); if (err != WSAEWOULDBLOCK) { - delete pnm; + delete[] pnm; HandleRecvError(); return false; } @@ -704,7 +704,7 @@ bool SocConnection::Poll() MpTrace("< %s", PszFromNetMessage(pnm)); m_pccb->OnReceive(this, pnm); } - delete pnm; + delete[] pnm; } return true; diff --git a/game/TriggerActions.cpp b/game/TriggerActions.cpp index 80b93e3..728873b 100644 --- a/game/TriggerActions.cpp +++ b/game/TriggerActions.cpp @@ -466,7 +466,7 @@ void EndMissionAction::OnMPEndMissionActionEvent(int nWinLose, Side side) { EcomAction::~EcomAction() { - delete m_pszMessage; + delete[] m_pszMessage; } bool EcomAction::Init(char *psz) diff --git a/game/Unit.cpp b/game/Unit.cpp index ef24fab..84612b0 100644 --- a/game/Unit.cpp +++ b/game/Unit.cpp @@ -234,7 +234,7 @@ void UnitGob::ExitClass(UnitConsts *puntc) delete puntc->pfrmMenu; puntc->pfrmMenu = NULL; - delete puntc->szDescription; + delete[] puntc->szDescription; puntc->szDescription = NULL; } diff --git a/game/UnitGroupMgr.cpp b/game/UnitGroupMgr.cpp index a050045..d6fc89c 100644 --- a/game/UnitGroupMgr.cpp +++ b/game/UnitGroupMgr.cpp @@ -37,7 +37,7 @@ bool UnitGroupMgr::Init(IniReader *pini) for (int iug = 0; iug < m_cug; iug++) { if (!m_aug[iug].Init(pini, iug)) { - delete m_aug; + delete[] m_aug; m_aug = NULL; return false; } @@ -199,7 +199,7 @@ UnitGroup::UnitGroup() UnitGroup::~UnitGroup() { - delete m_aule; + delete[] m_aule; // Delete Actions @@ -238,7 +238,7 @@ bool UnitGroup::LoadState(Stream *pstm) UnitListEntry *aule = new UnitListEntry[cule]; Assert(aule != NULL, "out of memory!"); if (aule != NULL) { - delete m_aule; + delete[] m_aule; m_aule = aule; m_cule = cule; } @@ -494,7 +494,7 @@ void UnitGroup::AddUnit(UnitGob *punt, bool fReplicant) return; memcpy(auleNew, m_aule, sizeof(UnitListEntry) * m_cule); - delete m_aule; + delete[] m_aule; m_aule = auleNew; m_aule[m_cule].gid = punt->GetId(); m_aule[m_cule].ut = punt->GetConsts()->ut; @@ -1442,4 +1442,4 @@ bool GuardVicinityUnitGroupAction::Perform(UnitGroup *pug) return false; } -} // namespace wi \ No newline at end of file +} // namespace wi diff --git a/game/bitmap.cpp b/game/bitmap.cpp index e0c74e8..ff0dc6b 100644 --- a/game/bitmap.cpp +++ b/game/bitmap.cpp @@ -30,7 +30,7 @@ DibBitmap::DibBitmap() DibBitmap::~DibBitmap() { if (m_wf & kfDibFreeMem) - delete m_pb; + delete[] m_pb; m_pb = NULL; } diff --git a/game/cachemgr.cpp b/game/cachemgr.cpp index 6b2aff5..9c71c6e 100644 --- a/game/cachemgr.cpp +++ b/game/cachemgr.cpp @@ -28,7 +28,7 @@ void CacheMgr::Exit() // Free CacheEntry list - delete m_pceList; + delete[] m_pceList; m_pceList = NULL; m_pceFree = NULL; } @@ -225,4 +225,4 @@ bool CacheMgr::MakeSpace(dword cb) return false; } -} // namespace wi \ No newline at end of file +} // namespace wi diff --git a/game/filepdbreader.cpp b/game/filepdbreader.cpp index e3e3d5c..1c06357 100644 --- a/game/filepdbreader.cpp +++ b/game/filepdbreader.cpp @@ -82,7 +82,7 @@ void FilePdbReader::Close() Assert(m_pfil != NULL); fclose(m_pfil); m_pfil = NULL; - delete m_aphcRecordData; + delete[] m_aphcRecordData; } bool FilePdbReader::GetRecordSize(word nRec, word *pcb) diff --git a/game/fogmap.cpp b/game/fogmap.cpp index db4c40f..9a8769a 100644 --- a/game/fogmap.cpp +++ b/game/fogmap.cpp @@ -30,7 +30,7 @@ FogMap::FogMap() FogMap::~FogMap() { delete m_panidWalls; - delete m_pbMap; + delete[] m_pbMap; int n; for (n = 0; n < 16; n++) delete m_aptbm[n]; diff --git a/game/game.cpp b/game/game.cpp index 78f246a..851df19 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -625,7 +625,7 @@ bool Game::LoadGameData() if (gcxTile > 16) { if (gcbScratch <= 10 * 1024) { - delete gpbScratch; + delete[] gpbScratch; if (gcxTile == 32) { gcbScratch = 35 * 1024; } else { @@ -820,7 +820,7 @@ void Game::AddModeMatches(int nDepthData, int nSizeData, int nDepthOrGreater, in continue; if (m_amm != NULL) { memcpy(pmm, m_amm, sizeof(ModeMatch) * m_cmm); - delete m_amm; + delete[] m_amm; } m_amm = pmm; m_cmmAlloc += kcmmGrow; @@ -2066,7 +2066,7 @@ void Game::Exit() delete gpdisp; gpdisp = NULL; - delete m_amm; + delete[] m_amm; m_amm = NULL; m_cmm = 0; m_cmmAlloc = 0; @@ -2082,7 +2082,7 @@ void Game::Exit() DbLogExit(); #endif - delete gpbScratch; + delete[] gpbScratch; gpbScratch = NULL; m_fSimUninitialized = true; diff --git a/game/hashtablecode.cpp b/game/hashtablecode.cpp index bd0750e..bdde0b5 100644 --- a/game/hashtablecode.cpp +++ b/game/hashtablecode.cpp @@ -38,7 +38,7 @@ bool HashTableCode::Init() void HashTableCode::Exit() { DiscardHashEntries(); - delete m_aphec; + delete[] m_aphec; m_aphec = NULL; // Free free list entries @@ -127,4 +127,4 @@ HashEntryCode *HashTableCode::FindEntry(dword hkName, int x, int y, int cx, int gcam.Add((CacheEntry *)phec); return phec; -} \ No newline at end of file +} diff --git a/game/memmgr.cpp b/game/memmgr.cpp index 07f6f10..aae0bf3 100644 --- a/game/memmgr.cpp +++ b/game/memmgr.cpp @@ -186,7 +186,7 @@ void MemMgr::Init(dword cbDynReserve, dword cbMaxNeeded, dword *pcbTotal) Heap *pheap = NewHeap(pv, (word)cbAlloc, false, 0, NULL); if (pheap == NULL) { - delete (byte *)pv; + delete[] (byte *)pv; break; } m_apheap[m_cheap++] = pheap; @@ -273,7 +273,7 @@ void MemMgr::Exit() } else { // Free the dyn chunk - delete pheap->pbHeap; + delete[] pheap->pbHeap; } delete pheap; } @@ -295,7 +295,7 @@ void MemMgr::Exit() for (int ihtab = 0; ihtab < m_chtab; ihtab++) delete m_aphtab[ihtab]; - delete m_aphtab; + delete[] m_aphtab; m_chtab = 0; m_chtabAlloced = 0; m_aphtab = NULL; @@ -337,7 +337,7 @@ HandleTable *MemMgr::NewHandleTable() return NULL; if (m_aphtab != NULL) { memcpy(aphtabT, m_aphtab, sizeof(HandleTable *) * m_chtabAlloced); - delete m_aphtab; + delete[] m_aphtab; } m_aphtab = aphtabT; m_chtabAlloced += kchtabGrow; diff --git a/game/mempdbreader.cpp b/game/mempdbreader.cpp index 2316c22..fe666a2 100644 --- a/game/mempdbreader.cpp +++ b/game/mempdbreader.cpp @@ -62,9 +62,9 @@ void MemPdbReader::Close() { Assert(m_cMapped == 0); Assert(m_pb != NULL); - delete m_pb; + delete[] m_pb; m_pb = NULL; - delete m_aphcRecordData; + delete[] m_aphcRecordData; m_aphcRecordData = NULL; } @@ -238,7 +238,7 @@ void MemPdbReader::UnmapRecord(word nRec, void *pvCookie) // Pointed to alloced object; unlock it byte *pb = (byte *)pvCookie; - delete pb; + delete[] pb; } } diff --git a/game/misc.cpp b/game/misc.cpp index 93ab2ac..01f238f 100644 --- a/game/misc.cpp +++ b/game/misc.cpp @@ -788,7 +788,7 @@ void SetHslAdjustedPalette(Palette *ppal, short nHueOffset, short nSatMultiplier } gpdisp->SetPalette(ppalMod); - delete ppalMod; + delete[] ppalMod; } // Takes byte-sized RGB values in the range from 0-255 and returns diff --git a/game/misccontrols.cpp b/game/misccontrols.cpp index 4c78551..0098a2a 100644 --- a/game/misccontrols.cpp +++ b/game/misccontrols.cpp @@ -1923,7 +1923,7 @@ RadioButtonBarControl::RadioButtonBarControl() RadioButtonBarControl::~RadioButtonBarControl() { for (int i = 0; i < m_cLabels; i++) { - delete m_apszLabels[i]; + delete[] m_apszLabels[i]; } } diff --git a/game/missionlist.cpp b/game/missionlist.cpp index 1cae2a8..8b9cd7a 100644 --- a/game/missionlist.cpp +++ b/game/missionlist.cpp @@ -30,10 +30,10 @@ MissionList::~MissionList() { while (ppdbiT->plvliFirst != NULL) { LvlItem *plvliT = ppdbiT->plvliFirst; ppdbiT->plvliFirst = ppdbiT->plvliFirst->plvliNext; - delete plvliT->pszFilename; + delete[] plvliT->pszFilename; delete plvliT; } - delete ppdbiT->pszTitle; + delete[] ppdbiT->pszTitle; delete ppdbiT; } } diff --git a/game/soundmgr.cpp b/game/soundmgr.cpp index d3f55ee..b069a89 100644 --- a/game/soundmgr.cpp +++ b/game/soundmgr.cpp @@ -97,9 +97,9 @@ void SoundMgr::Exit() m_apcmh[n].pb = NULL; } } - delete m_apcmh; + delete[] m_apcmh; m_apcmh = NULL; - delete m_afmap; + delete[] m_afmap; m_afmap = NULL; m_cpcmh = 0; diff --git a/game/tbitmap.cpp b/game/tbitmap.cpp index 9d8a64d..ca0af94 100644 --- a/game/tbitmap.cpp +++ b/game/tbitmap.cpp @@ -47,7 +47,7 @@ void FreeSharedTBitmaps() delete pshr->ptbm; gmmgr.FreePtr(pshr); } - delete gapshr; + delete[] gapshr; gapshr = NULL; gcshr = 0; gcshrAlloc = 0; @@ -91,7 +91,7 @@ TBitmap *GetSharedTBitmap(char *pszFn) return NULL; if (gapshr != NULL) { memcpy(ppshr, gapshr, sizeof(SharedRecord *) * gcshr); - delete gapshr; + delete[] gapshr; } gapshr = ppshr; gcshrAlloc += kcshrGrow; @@ -166,14 +166,14 @@ bool TBitmap::InitClass() else s_ampscaiclrSide[i] = (dword *)gmmgr.AllocPtr(cbAlloc); if (s_ampscaiclrSide[i] == NULL) { - delete mpscaiclrSideT; + delete[] mpscaiclrSideT; return false; } gmmgr.WritePtr(s_ampscaiclrSide[i], 0, mpscaiclrSideT, cbAlloc); if (iclrFirst == iclrLast && gcxTile >= 24) gmmgr.WritePtr(s_ampscaiclrSide[i], cbAlloc, mpscaiclrSideT, cbAlloc); } - delete mpscaiclrSideT; + delete[] mpscaiclrSideT; // Done @@ -221,7 +221,7 @@ TBitmap::~TBitmap() { Assert(!(m_wf & kfTbShared)); - delete m_ahc; + delete[] m_ahc; m_ahc = NULL; if (m_atbe != NULL) { gmmgr.FreePtr(m_atbe); @@ -290,12 +290,12 @@ bool TBitmap::Init(File *pfil, word ib) word cbAlloc = sizeof(TBitmapEntry) * m_ctbm; TBitmapEntry *ptbeT = (TBitmapEntry *)gmmgr.AllocPtr(cbAlloc); if (ptbeT == NULL) { - delete ptbe; + delete[] ptbe; return false; } gmmgr.WritePtr(ptbeT, 0, ptbe, cbAlloc); m_atbe = ptbeT; - delete ptbe; + delete[] ptbe; // Remember file and offset diff --git a/game/terrainmap.cpp b/game/terrainmap.cpp index 57b09b9..e46cfa5 100644 --- a/game/terrainmap.cpp +++ b/game/terrainmap.cpp @@ -56,7 +56,7 @@ TerrainMap::~TerrainMap() { if (m_ptrmaph != NULL) gpakr.UnmapFile(&m_fmap); - delete m_abBuffer; + delete[] m_abBuffer; while (m_ppathhList != NULL) RemovePathHead(m_ppathhList); for (PathHead *ppathh = m_ppathhFreeList; ppathh != NULL; ) { @@ -801,7 +801,7 @@ Path::Path() Path::~Path() { - delete m_adir; + delete[] m_adir; } bool Path::Init(TerrainMap *ptrmap, TCoord txStart, TCoord tyStart, Direction *adir, int cdir) @@ -948,7 +948,7 @@ bool Path::Append(Path *ppath) return false; memcpy(adirNew, m_adir, m_cdirs); memcpy(&adirNew[m_cdirs], ppath->m_adir, ppath->m_cdirs); - delete m_adir; + delete[] m_adir; m_adir = adirNew; m_cdirs += ppath->m_cdirs; return true; @@ -963,7 +963,7 @@ bool Path::TrimEnd(int itptStart) if (adirNew == NULL) return false; memcpy(adirNew, m_adir, cdirsNew); - delete m_adir; + delete[] m_adir; m_adir = adirNew; m_cdirs = cdirsNew; return true; @@ -1209,4 +1209,4 @@ bool TrackPoint::IsBetterSort(TrackPoint *ptrkpA) #endif } -} // namespace wi \ No newline at end of file +} // namespace wi diff --git a/game/tilemap.cpp b/game/tilemap.cpp index b666f92..a31c5c7 100644 --- a/game/tilemap.cpp +++ b/game/tilemap.cpp @@ -34,7 +34,7 @@ TileMap::~TileMap() gpakr.UnmapFile(&m_fmapMiniTset); if (m_apbTileData != NULL) gmmgr.FreePtr(m_apbTileData); - delete m_apbDrawMap; + delete[] m_apbDrawMap; } bool TileMap::Load(char *psz, Size *psizPlayfield) @@ -105,11 +105,11 @@ bool TileMap::Load(char *psz, Size *psizPlayfield) int cbT = sizeof(byte *) * m_cTiles; m_apbTileData = (byte **)gmmgr.AllocPtr(cbT); if (m_apbTileData == NULL) { - delete apbTileData; + delete[] apbTileData; return false; } gmmgr.WritePtr(m_apbTileData, 0, apbTileData, cbT); - delete apbTileData; + delete[] apbTileData; // Load mini tset @@ -235,4 +235,4 @@ void TileMap::Draw(DibBitmap *pbm, int x, int y, int cx, int cy, int xMap, int y DrawTileMapThunk(m_apbDrawMap, m_ctx, m_cty, pbDib, sizDib.cx, pmnfo->cxLeftTile, pmnfo->cyTopTile, pmnfo->cxRightTile, pmnfo->cyBottomTile, pmnfo->ctxInside, pmnfo->ctyInside, gcxTile, gcyTile); } -} // namespace wi \ No newline at end of file +} // namespace wi diff --git a/game/updatemap.cpp b/game/updatemap.cpp index b71f2d4..7b7e149 100644 --- a/game/updatemap.cpp +++ b/game/updatemap.cpp @@ -19,8 +19,8 @@ UpdateMap::UpdateMap() UpdateMap::~UpdateMap() { - delete m_afInvalid; - delete m_afInvalidDamage; + delete[] m_afInvalid; + delete[] m_afInvalidDamage; } bool UpdateMap::Init(Size *psiz) @@ -29,8 +29,8 @@ bool UpdateMap::Init(Size *psiz) m_ctx = (psiz->cx + (gcxTile - 1)) / gcxTile + 1; m_cty = (psiz->cy + (gcyTile - 1)) / gcyTile + 1; int cb = m_ctx * m_cty; - delete m_afInvalid; - delete m_afInvalidDamage; + delete[] m_afInvalid; + delete[] m_afInvalidDamage; m_afInvalid = new bool[cb]; if (m_afInvalid == NULL) return false; @@ -606,7 +606,7 @@ bool UpdateMap::Scroll(int dx, int dy) // Now scrolled. Cleanup - delete pfT; + delete[] pfT; } else { // Couldn't alloc temp buffer, so invalidate everything diff --git a/mpshared/messages.cpp b/mpshared/messages.cpp index 0fb2f0b..ee50130 100644 --- a/mpshared/messages.cpp +++ b/mpshared/messages.cpp @@ -279,7 +279,7 @@ XMsgGameNetMessage *XMsgGameNetMessage::FromBuffer(base::ByteBuffer& bb, Assert(cbSav - bb.Length() == cbMsg); if (cbSav - bb.Length() != cbMsg) { - delete pb; + delete[] pb; return NULL; } @@ -516,7 +516,7 @@ XMsgRoomGamePlayerNames *XMsgRoomGamePlayerNames::FromBuffer( if (cbSav - bb.Length() != w) { Assert(); - delete anames; + delete[] anames; return NULL; } diff --git a/mpshared/messages.h b/mpshared/messages.h index 02a62b6..f3543d8 100644 --- a/mpshared/messages.h +++ b/mpshared/messages.h @@ -195,7 +195,7 @@ struct XMsgShowMessage : public XMsg { disconnect_ = disconnect; } ~XMsgShowMessage() { - delete message_; + delete[] message_; } const char *message_; dword ipRedirect_; @@ -219,7 +219,7 @@ struct XMsgLobbyAddRoom : public XMsg { cGames_ = cGames; } ~XMsgLobbyAddRoom() { - delete room_; + delete[] room_; } const char *room_; dword roomid_; @@ -268,7 +268,7 @@ struct XMsgRoomGamePlayerNames : public XMsg XMsgRoomGamePlayerNames(dword gameid, dword cnames, PlayerName *anames) : XMsg(XMSG_ROOMGAMEPLAYERNAMES), gameid_(gameid), cnames_(cnames), anames_(anames) { } - virtual ~XMsgRoomGamePlayerNames() { delete anames_; } + virtual ~XMsgRoomGamePlayerNames() { delete[] anames_; } dword gameid_; dword cnames_; PlayerName *anames_;