| 289 | //========================================================================== |
| 290 | |
| 291 | void C_DeinitConsole () |
| 292 | { |
| 293 | GameAtExit *cmd = ExitCmdList; |
| 294 | |
| 295 | while (cmd != NULL) |
| 296 | { |
| 297 | GameAtExit *next = cmd->Next; |
| 298 | AddCommandString (cmd->Command.GetChars()); |
| 299 | delete cmd; |
| 300 | cmd = next; |
| 301 | } |
| 302 | |
| 303 | // Free command history |
| 304 | History *hist = HistTail; |
| 305 | |
| 306 | while (hist != NULL) |
| 307 | { |
| 308 | History *next = hist->Newer; |
| 309 | delete hist; |
| 310 | hist = next; |
| 311 | } |
| 312 | HistTail = HistHead = HistPos = NULL; |
| 313 | |
| 314 | // Free alias commands. (i.e. The "commands" that can be allocated |
| 315 | // at runtime.) |
| 316 | for (size_t i = 0; i < countof(Commands); ++i) |
| 317 | { |
| 318 | FConsoleCommand *command = Commands[i]; |
| 319 | |
| 320 | while (command != NULL) |
| 321 | { |
| 322 | FConsoleCommand *nextcmd = command->m_Next; |
| 323 | if (command->IsAlias()) |
| 324 | { |
| 325 | delete command; |
| 326 | } |
| 327 | command = nextcmd; |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | // Make sure all tab commands are cleared before the memory for |
| 332 | // their names is deallocated. |
| 333 | C_ClearTabCommands (); |
| 334 | C_ClearDynCCmds(); |
| 335 | |
| 336 | // Free AddToConsole()'s work buffer |
| 337 | if (work != NULL) |
| 338 | { |
| 339 | free (work); |
| 340 | work = NULL; |
| 341 | worklen = 0; |
| 342 | } |
| 343 | |
| 344 | if (conbuffer != NULL) |
| 345 | { |
| 346 | delete conbuffer; |
| 347 | conbuffer = NULL; |
| 348 | } |
no test coverage detected