Skip to content

Commit

Permalink
FIx incorrect deletion of memory allocated with new[]
Browse files Browse the repository at this point in the history
#91
  • Loading branch information
SamVanheer committed Nov 28, 2021
1 parent e27bc78 commit c9f8080
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions dlls/nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3305,14 +3305,12 @@ void CGraph ::ComputeStaticRoutingTables()
}
ALERT(at_aiconsole, "Size of Routes = %d\n", nTotalCompressedSize);
}
if (Routes)
delete Routes;
if (BestNextNodes)
delete BestNextNodes;
if (pRoute)
delete pRoute;
if (pMyPath)
delete pMyPath;

delete[] Routes;
delete[] BestNextNodes;
delete[] pRoute;
delete[] pMyPath;

Routes = 0;
BestNextNodes = 0;
pRoute = 0;
Expand Down Expand Up @@ -3447,10 +3445,8 @@ void CGraph ::TestRoutingTables()

EnoughSaid:

if (pMyPath)
delete pMyPath;
if (pMyPath2)
delete pMyPath2;
delete[] pMyPath;
delete[] pMyPath2;
pMyPath = 0;
pMyPath2 = 0;
}
Expand Down

0 comments on commit c9f8080

Please sign in to comment.