From 133350fb9cd087cd4df5dd9681dd17e52f728aac Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 17 Feb 2008 02:40:03 +0000 Subject: [PATCH] - Fixed AInventory::PickupFlash setting with GCC. - Fixed: The MusicVolumes list was allocated with M_Malloc but freed with delete. - Fixed: demobuffer was inconsistantly handled with new[]/delete[] and malloc/free. - Added used memory tracking to M_Malloc() and M_Realloc(). This necessitated the addition of an M_Free() call to track frees. - Removed M_Calloc since it was only used in one place, and can just as well be done with an M_Malloc/memset pair. - Bumped DEMOGAMEVERSION for the new net controller codes. SVN r751 (trunk) --- docs/rh-log.txt | 30 +++++-- src/c_console.cpp | 4 +- src/c_expr.cpp | 12 +-- src/d_net.cpp | 2 +- src/dobject.h | 2 +- src/dobjtype.cpp | 2 +- src/farchive.cpp | 15 ++-- src/g_game.cpp | 8 +- src/infodefaults.cpp | 2 +- src/m_alloc.cpp | 116 ++++++++++++++++++++------- src/m_alloc.h | 28 +++---- src/name.cpp | 4 +- src/p_setup.cpp | 2 +- src/p_switch.cpp | 7 +- src/r_anim.cpp | 2 +- src/r_data.cpp | 4 +- src/r_plane.cpp | 7 +- src/r_translate.cpp | 2 +- src/s_advsound.cpp | 2 +- src/s_sndseq.cpp | 6 +- src/stringtable.cpp | 8 +- src/tarray.h | 10 +-- src/textures/rawpagetexture.cpp | 6 +- src/textures/texture.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 9 ++- src/thingdef/thingdef_states.cpp | 2 +- src/version.h | 2 +- src/w_wad.cpp | 4 +- src/win32/st_start.cpp | 2 +- 29 files changed, 193 insertions(+), 109 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 72c97c19db..9c38340a6f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,18 +1,34 @@ +February 16, 2008 +- Fixed AInventory::PickupFlash setting with GCC. +- Fixed: The MusicVolumes list was allocated with M_Malloc but freed with + delete. +- Fixed: demobuffer was inconsistantly handled with new[]/delete[] and + malloc/free. +- Added used memory tracking to M_Malloc() and M_Realloc(). This + necessitated the addition of an M_Free() call to track frees. +- Removed M_Calloc since it was only used in one place, and can just as well + be done with an M_Malloc/memset pair. +- Bumped DEMOGAMEVERSION for the new net controller codes. + February 16, 2008 (Changes by Graf Zahl) - Added patch by Karate Chris: - The net arbitrator can add or remove players to an access list so they can or cannot control game settings: - * net_addcontroller - Adds a player to the control list. Only net arbitrators have access to this command. - * net_removecontroller - Removes a player from the control list. Only net arbitrators have access to this command. - * net_listcontrollers - Lists the players who are able to control the game settings. - - Fixed: The 'Printf'' occurrences in the 'addplayerclass' console command were all missing a '\n' at the end. - - Enhanced the 'playerinfo' console command so more information about each setting is shown. - + * net_addcontroller - Adds a player to the control list. + Only net arbitrators have access to this command. + * net_removecontroller - Removes a player from the control + list. Only net arbitrators have access to this command. + * net_listcontrollers - Lists the players who are able to control the game + settings. + - Fixed: The 'Printf' occurrences in the 'addplayerclass' console command + were all missing a '\n' at the end. + - Enhanced the 'playerinfo' console command so more information about each + setting is shown. - Added customizable pickup flash. - Added option to show shorter messages for save game and screenshot confirmation. Also added this to the 'Messages' menu. -February 15, 2008 +February 14, 2008 - Version bump to 2.2.0. - Disabled console alpha when the console is fullscreen. - Re-enabled maybedrawnow for the software renderer. This should be replaced diff --git a/src/c_console.cpp b/src/c_console.cpp index 89171d8ce5..9a3920a1f9 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -449,7 +449,7 @@ void C_DeinitConsole () { GameAtExit *next = cmd->Next; AddCommandString (cmd->Command); - free (cmd); + M_Free (cmd); cmd = next; } @@ -1675,7 +1675,7 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len) if (HistSize == MAXHISTSIZE) { HistTail = HistTail->Newer; - free (HistTail->Older); + M_Free (HistTail->Older); HistTail->Older = NULL; } else diff --git a/src/c_expr.cpp b/src/c_expr.cpp index fa8e408190..82d972bd13 100644 --- a/src/c_expr.cpp +++ b/src/c_expr.cpp @@ -233,8 +233,8 @@ missing: Printf ("Missing argument to %s\n", token); done: - if (prod2 != NULL) free (prod2); - if (prod1 != NULL) free (prod1); + if (prod2 != NULL) M_Free (prod2); + if (prod1 != NULL) M_Free (prod1); return prod3; } @@ -353,7 +353,7 @@ static FStringProd *DoubleToString (FProduction *prod) sprintf (buf, "%g", static_cast(prod)->Value); newprod = NewStringProd (buf); - free (prod); + M_Free (prod); return newprod; } @@ -368,7 +368,7 @@ static FDoubleProd *StringToDouble (FProduction *prod) FDoubleProd *newprod; newprod = NewDoubleProd (atof (static_cast(prod)->Value)); - free (prod); + M_Free (prod); return newprod; } @@ -746,7 +746,7 @@ CCMD (test) } if (prod != NULL) { - free (prod); + M_Free (prod); } } @@ -802,7 +802,7 @@ CCMD (eval) Printf ("%s\n", static_cast(prod)->Value); } } - free (prod); + M_Free (prod); return; } } diff --git a/src/d_net.cpp b/src/d_net.cpp index 53d90068f6..896b974cb2 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -197,7 +197,7 @@ static struct TicSpecial { if (streams[i]) { - free (streams[i]); + M_Free (streams[i]); streams[i] = NULL; used[i] = 0; } diff --git a/src/dobject.h b/src/dobject.h index f06f43ddd8..f18f1e03cd 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -283,7 +283,7 @@ public: void operator delete (void *mem) { - free (mem); + M_Free(mem); } protected: diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index dbcda05c2b..070429c1fc 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -305,7 +305,7 @@ void PClass::FreeStateList () if (ActorInfo != NULL && ActorInfo->StateList != NULL) { ActorInfo->StateList->Destroy(); - free (ActorInfo->StateList); + M_Free (ActorInfo->StateList); ActorInfo->StateList = NULL; } } diff --git a/src/farchive.cpp b/src/farchive.cpp index 574b9f7dbf..7d17c8d4c6 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -229,7 +229,10 @@ void FCompressedFile::Close () m_File = NULL; } if (m_Buffer) - free (m_Buffer); + { + M_Free (m_Buffer); + m_Buffer = NULL; + } BeEmpty (); } @@ -372,7 +375,7 @@ void FCompressedFile::Implode () memcpy (m_Buffer + 8, compressed, outlen); if (compressed) delete[] compressed; - free (oldbuf); + M_Free (oldbuf); } void FCompressedFile::Explode () @@ -396,7 +399,7 @@ void FCompressedFile::Explode () r = uncompress (expand, &newlen, m_Buffer + 8, cprlen); if (r != Z_OK || newlen != expandsize) { - free (expand); + M_Free (expand); I_Error ("Could not decompress cfile"); } } @@ -405,7 +408,7 @@ void FCompressedFile::Explode () memcpy (expand, m_Buffer + 8, expandsize); } if (FreeOnExplode ()) - free (m_Buffer); + M_Free (m_Buffer); m_Buffer = expand; m_BufferSize = expandsize; } @@ -430,7 +433,7 @@ FCompressedMemFile::~FCompressedMemFile () { if (m_ImplodedBuffer != NULL) { - free (m_ImplodedBuffer); + M_Free (m_ImplodedBuffer); } } @@ -672,7 +675,7 @@ FArchive::~FArchive () if (m_TypeMap) delete[] m_TypeMap; if (m_ObjectMap) - free (m_ObjectMap); + M_Free (m_ObjectMap); if (m_SpriteMap) delete[] m_SpriteMap; } diff --git a/src/g_game.cpp b/src/g_game.cpp index 0f733f5501..a0d3ec1c3f 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2436,7 +2436,7 @@ bool G_ProcessIFFDemo (char *mapname) delete[] uncompressed; return true; } - delete[] demobuffer; + M_Free (demobuffer); zdembodyend = uncompressed + uncompSize; demobuffer = demo_p = uncompressed; } @@ -2456,7 +2456,7 @@ void G_DoPlayDemo (void) if (demolump >= 0) { int demolen = Wads.LumpLength (demolump); - demobuffer = new BYTE[demolen]; + demobuffer = (BYTE *)M_Malloc(demolen); Wads.ReadLump (demolump, demobuffer); } else @@ -2547,7 +2547,7 @@ bool G_CheckDemoStatus (void) C_RestoreCVars (); // [RH] Restore cvars demo might have changed - delete[] demobuffer; + M_Free (demobuffer); demoplayback = false; netdemo = false; netgame = false; @@ -2620,7 +2620,7 @@ bool G_CheckDemoStatus (void) WriteLong (demo_p - demobuffer - 8, &formlen); M_WriteFile (demoname, demobuffer, demo_p - demobuffer); - free (demobuffer); + M_Free (demobuffer); demorecording = false; stoprecording = false; Printf ("Demo %s recorded\n", demoname); diff --git a/src/infodefaults.cpp b/src/infodefaults.cpp index aad622bb79..93be77539f 100644 --- a/src/infodefaults.cpp +++ b/src/infodefaults.cpp @@ -255,7 +255,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint) case ADEF_Inventory_FlagsSet: item->ItemFlags |= dataint; break; case ADEF_Inventory_FlagsClear: item->ItemFlags &= ~dataint; break; - case ADEF_Inventory_PickupFlash:item->PickupFlash = dataint? fuglyname("PickupFlash") : NULL; + case ADEF_Inventory_PickupFlash:if(dataint) { item->PickupFlash = fuglyname("PickupFlash"); } else { item->PickupFlash = NULL; } break; case ADEF_Inventory_Amount: item->Amount = dataint; break; case ADEF_Inventory_RespawnTics:item->RespawnTics = dataint; break; case ADEF_Inventory_MaxAmount: item->MaxAmount = dataint; break; diff --git a/src/m_alloc.cpp b/src/m_alloc.cpp index f448c9d913..453cd14dd6 100644 --- a/src/m_alloc.cpp +++ b/src/m_alloc.cpp @@ -1,9 +1,9 @@ /* ** m_alloc.cpp -** Wrappers for the malloc family of functions +** Wrappers for the malloc family of functions that count used bytes. ** **--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit +** Copyright 1998-2008 Randy Heit ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -32,39 +32,93 @@ ** */ -#if !defined(_DEBUG) || !defined(_MSC_VER) - #include "i_system.h" -#include "m_alloc.h" -void *M_Malloc (size_t size) +#include "stats.h" + +ADD_STAT(mem) { - void *zone = malloc (size); - - if (!zone) - I_FatalError ("Could not malloc %u bytes", size); - - return zone; + FString out; + out.Format("Alloc: %uKB", (AllocBytes + 1023) >> 10); + return out; } -void *M_Calloc (size_t num, size_t size) -{ - void *zone = calloc (num, size); - - if (!zone) - I_FatalError ("Could not calloc %u bytes", num * size); - - return zone; -} - -void *M_Realloc (void *memblock, size_t size) -{ - void *zone = realloc (memblock, size); - - if (!zone) - I_FatalError ("Could not realloc %u bytes", size); - - return zone; -} +size_t AllocBytes; +#ifndef _MSC_VER +#define _NORMAL_BLOCK 0 +#define _malloc_dbg(s,b,f,l) malloc(s) +#define _realloc_dbg(p,s,b,f,l) realloc(p,s) #endif +#ifndef _WIN32 +#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD +#else +#include +#endif + +#ifndef _DEBUG +void *M_Malloc(size_t size) +{ + void *block = malloc(size); + + if (block == NULL) + I_FatalError("Could not malloc %u bytes", size); + + AllocBytes += _msize(block); + return block; +} + +void *M_Realloc(void *memblock, size_t size) +{ + if (memblock != NULL) + { + AllocBytes -= _msize(memblock); + } + void *block = realloc(memblock, size); + if (block == NULL) + { + I_FatalError("Could not realloc %u bytes", size); + } + AllocBytes += _msize(block); + return block; +} +#else +#ifdef _MSC_VER +#include +#endif + +void *M_Malloc_Dbg(size_t size, const char *file, int lineno) +{ + void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno); + + if (block == NULL) + I_FatalError("Could not malloc %u bytes", size); + + AllocBytes += _msize(block); + return block; +} + +void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno) +{ + if (memblock != NULL) + { + AllocBytes -= _msize(memblock); + } + void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno); + if (block == NULL) + { + I_FatalError("Could not realloc %u bytes", size); + } + AllocBytes += _msize(block); + return block; +} +#endif + +void M_Free (void *block) +{ + if (block != NULL) + { + AllocBytes -= _msize(block); + free(block); + } +} diff --git a/src/m_alloc.h b/src/m_alloc.h index 2b18c7c3a6..8d7866a7f2 100644 --- a/src/m_alloc.h +++ b/src/m_alloc.h @@ -2,7 +2,7 @@ ** m_alloc.h ** **--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit +** Copyright 1998-2008 Randy Heit ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -34,26 +34,26 @@ #ifndef __M_ALLOC_H__ #define __M_ALLOC_H__ -#if !defined(_DEBUG) || !defined(_MSC_VER) #include // These are the same as the same stdlib functions, -// except they bomb out with an error requester +// except they bomb out with a fatal error // when they can't get the memory. -void *M_Malloc (size_t size); -void *M_Calloc (size_t num, size_t size); -void *M_Realloc (void *memblock, size_t size); +#if defined(_DEBUG) +#define M_Malloc(s) M_Malloc_Dbg(s, __FILE__, __LINE__) +#define M_Realloc(p,s) M_Realloc_Dbg(p, s, __FILE__, __LINE__) +void *M_Malloc_Dbg (size_t size, const char *file, int lineno); +void *M_Realloc_Dbg (void *memblock, size_t size, const char *file, int lineno); #else - -#include -#include - -#define M_Malloc(size) malloc(size) -#define M_Calloc(num, size) calloc(num, size) -#define M_Realloc(memblock, size) realloc(memblock, size) - +void *M_Malloc (size_t size); +void *M_Realloc (void *memblock, size_t size); #endif +void M_Free (void *memblock); + +// Number of bytes currently allocated through M_Malloc/M_Realloc +extern size_t AllocBytes; + #endif //__M_ALLOC_H__ diff --git a/src/name.cpp b/src/name.cpp index b8a7d123e9..eeb30420b8 100644 --- a/src/name.cpp +++ b/src/name.cpp @@ -270,13 +270,13 @@ FName::NameManager::~NameManager() for (block = Blocks; block != NULL; block = next) { next = block->NextBlock; - free (block); + M_Free (block); } Blocks = NULL; if (NameArray != NULL) { - free (NameArray); + M_Free (NameArray); NameArray = NULL; } NumNames = MaxNames = 0; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 8e91413374..2977542c76 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3369,7 +3369,7 @@ void P_FreeExtraLevelData() while (node != NULL) { msecnode_t *next = node->m_snext; - free (node); + M_Free (node); node = next; } headsecnode = NULL; diff --git a/src/p_switch.cpp b/src/p_switch.cpp index e6f4aea53f..238b3dc92f 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -121,8 +121,11 @@ public: { for(unsigned i=0;itop)*(MAXWIDTH*2)); + check = (visplane_t *)M_Malloc (sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2)); + memset(check, 0, sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2)); check->bottom = &check->top[MAXWIDTH+2]; } else if (NULL == (freetail = freetail->next)) @@ -1637,7 +1638,7 @@ bool R_PlaneInitData () while (pl) { visplane_t *next = pl->next; - free (pl); + M_Free (pl); pl = next; } freetail = NULL; @@ -1650,7 +1651,7 @@ bool R_PlaneInitData () while (pl) { visplane_t *next = pl->next; - free (pl); + M_Free (pl); pl = next; } } diff --git a/src/r_translate.cpp b/src/r_translate.cpp index 2ea65daab4..4c6f9771ef 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -78,7 +78,7 @@ void FRemapTable::Free() KillNative(); if (Remap != NULL) { - free(Remap); + M_Free(Remap); Remap = NULL; Palette = NULL; NumEntries = 0; diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 8527d25aa5..110d5b423c 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -778,7 +778,7 @@ static void S_ClearSoundData() { FMusicVolume *me = MusicVolumes; MusicVolumes = me->Next; - delete me; + M_Free(me); } S_rnd.Clear(); diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 9de65367b0..8a1c8e60e8 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -154,7 +154,7 @@ struct FSoundSequencePtrArray : public TArray { for (unsigned int i = 0; i < Size(); ++i) { - free ((*this)[i]); + M_Free ((*this)[i]); } } }; @@ -463,7 +463,7 @@ void S_ParseSndSeq (int levellump) { if (Sequences[i]) { - free(Sequences[i]); + M_Free(Sequences[i]); } } Sequences.Clear(); @@ -496,7 +496,7 @@ void S_ParseSndSeq (int levellump) { if (Sequences[curseq]->SeqName == seqname) { - free (Sequences[curseq]); + M_Free (Sequences[curseq]); Sequences[curseq] = NULL; break; } diff --git a/src/stringtable.cpp b/src/stringtable.cpp index 6968357f7d..f4108a5bd9 100644 --- a/src/stringtable.cpp +++ b/src/stringtable.cpp @@ -80,7 +80,7 @@ void FStringTable::FreeData () while (entry != NULL) { next = entry->Next; - free (entry); + M_Free (entry); entry = next; } } @@ -98,7 +98,7 @@ void FStringTable::FreeNonDehackedStrings () if (entry->PassNum != 0) { *pentry = next; - free (entry); + M_Free (entry); } else { @@ -254,7 +254,7 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p if (cmpval == 0 && entry->PassNum >= passnum) { *pentry = entry->Next; - free (entry); + M_Free (entry); entry = NULL; } if (entry == NULL || cmpval > 0) @@ -396,6 +396,6 @@ void FStringTable::SetString (const char *name, const char *newString) { *pentry = entry; entry->Next = oentry->Next; - free (oentry); + M_Free (oentry); } } diff --git a/src/tarray.h b/src/tarray.h index d34e053338..44ea0537aa 100644 --- a/src/tarray.h +++ b/src/tarray.h @@ -89,7 +89,7 @@ public: { DoDelete (0, Count-1); } - free (Array); + M_Free (Array); } DoCopy (other); } @@ -103,7 +103,7 @@ public: { DoDelete (0, Count-1); } - free (Array); + M_Free (Array); Array = NULL; Count = 0; Most = 0; @@ -178,7 +178,7 @@ public: { if (Array != NULL) { - free (Array); + M_Free (Array); Array = NULL; } } @@ -604,7 +604,7 @@ protected: Nodes[i].~Node(); } } - free(Nodes); + M_Free(Nodes); Nodes = NULL; Size = 0; LastFree = NULL; @@ -628,7 +628,7 @@ protected: nold[i].~Node(); } } - free(nold); + M_Free(nold); } void Rehash() diff --git a/src/textures/rawpagetexture.cpp b/src/textures/rawpagetexture.cpp index 4cb80f639d..5ff6f69fbd 100644 --- a/src/textures/rawpagetexture.cpp +++ b/src/textures/rawpagetexture.cpp @@ -99,15 +99,15 @@ bool FRawPageTexture::Check(FileReader & data) } if (gapAtStart || (x != width)) { - free (foo); + M_Free (foo); return true; } - free(foo); + M_Free(foo); return false; } else { - free (foo); + M_Free (foo); return true; } } diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 2799d46fbc..9889e0dd17 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -266,7 +266,7 @@ FTexture::Span **FTexture::CreateSpans (const BYTE *pixels) const void FTexture::FreeSpans (Span **spans) const { - free (spans); + M_Free (spans); } void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation) diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 315f8703ad..874ed1dda0 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -401,7 +401,14 @@ static void HandleDeprecatedFlags(AActor *defaults, bool set, int index) defaults->meleethreshold = set? 196*FRACUNIT : 0; break; case 5: // INVENTORY.PICKUPFLASH - static_cast(defaults)->PickupFlash = set? fuglyname("PickupFlash") : NULL; + if (set) + { + static_cast(defaults)->PickupFlash = fuglyname("PickupFlash"); + } + else + { + static_cast(defaults)->PickupFlash = NULL; + } break; default: break; // silence GCC diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 169fc2ead6..56127a9381 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -331,7 +331,7 @@ void InstallStates(FActorInfo *info, AActor *defaults) if (info->StateList != NULL) { info->StateList->Destroy(); - free(info->StateList); + M_Free(info->StateList); } info->StateList = CreateStateLabelList(StateLabels); diff --git a/src/version.h b/src/version.h index 98c6f4c1ad..911faca614 100644 --- a/src/version.h +++ b/src/version.h @@ -64,7 +64,7 @@ // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x209 +#define DEMOGAMEVERSION 0x20A // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands. diff --git a/src/w_wad.cpp b/src/w_wad.cpp index fc4b5d42bb..4f431ef4ec 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -228,7 +228,7 @@ void FWadCollection::InitMultipleFiles (wadlist_t **filenames) DefaultExtension (name, ".wad"); AddFile (name); - free (*filenames); + M_Free (*filenames); *filenames = next; // The first two files are always zdoom.wad and the IWAD, which @@ -305,7 +305,7 @@ static DWORD Zip_FindCentralDir(FileReader * fin) FileSize = fin->Tell(); uMaxBack = MIN(0xffff, FileSize); - buf = (unsigned char*)M_Malloc(BUFREADCOMMENT+4); + buf = (unsigned char*)malloc(BUFREADCOMMENT+4); if (buf == NULL) return 0; uBackRead = 4; diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 43511136ff..10a832fc31 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -1437,7 +1437,7 @@ BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info) void ST_Util_FreeBitmap (BITMAPINFO *bitmap_info) { - free (bitmap_info); + M_Free (bitmap_info); } //==========================================================================