mirror of https://github.com/snes9xgit/snes9x.git
Fix some on-exit memory leaks
This commit is contained in:
parent
fc224c0df7
commit
17b3a81419
|
@ -153,6 +153,7 @@ SMP::SMP() {
|
|||
}
|
||||
|
||||
SMP::~SMP() {
|
||||
delete[] apuram;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -229,7 +229,8 @@ bool ConfigFile::LoadFile(const char *filename){
|
|||
n=filename;
|
||||
n2=strrchr(n, '/'); if(n2!=NULL) n=n2+1;
|
||||
n2=strrchr(n, '\\'); if(n2!=NULL) n=n2+1;
|
||||
LoadFile(new fStream(s), n);
|
||||
fStream fS(s);
|
||||
LoadFile(&fS, n);
|
||||
CLOSE_FSTREAM(s);
|
||||
ret = true;
|
||||
} else {
|
||||
|
|
|
@ -333,7 +333,8 @@ static bool try_load_config_file (const char *fname, ConfigFile &conf)
|
|||
if (fp)
|
||||
{
|
||||
fprintf(stdout, "Reading config file %s.\n", fname);
|
||||
conf.LoadFile(new fStream(fp));
|
||||
fStream fS(fp);
|
||||
conf.LoadFile(&fS);
|
||||
CLOSE_FSTREAM(fp);
|
||||
return (true);
|
||||
}
|
||||
|
|
|
@ -536,6 +536,23 @@ void InitRenderFilters(void)
|
|||
}
|
||||
}
|
||||
|
||||
void DeInitRenderFilters()
|
||||
{
|
||||
if (ntsc) {
|
||||
delete ntsc;
|
||||
}
|
||||
if (BlendBuf) {
|
||||
delete[] BlendBuf;
|
||||
}
|
||||
if (xbrz_thread_sync_data) {
|
||||
delete[] xbrz_thread_sync_data;
|
||||
delete[] xbrz_sync_handles;
|
||||
}
|
||||
|
||||
S9xBlit2xSaIFilterDeinit();
|
||||
S9xBlitHQ2xFilterDeinit();
|
||||
}
|
||||
|
||||
#define R5G6B5 // windows port uses RGB565
|
||||
|
||||
#ifdef R5G6B5
|
||||
|
|
|
@ -208,5 +208,6 @@ void RenderMethod(SSurface Src, SSurface Dst, RECT *);
|
|||
|
||||
void SelectRenderMethod();
|
||||
void InitRenderFilters();
|
||||
void DeInitRenderFilters();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -326,6 +326,7 @@ HANDLE SoundEvent;
|
|||
ExtList* valid_ext=NULL;
|
||||
void MakeExtFile(void);
|
||||
void LoadExts(void);
|
||||
void ClearExts(void);
|
||||
static bool ExtensionIsValid(const TCHAR *filename);
|
||||
|
||||
extern FILE *trace_fs;
|
||||
|
@ -3702,15 +3703,16 @@ loop_exit:
|
|||
|
||||
Memory.Deinit();
|
||||
|
||||
S9xGraphicsDeinit();
|
||||
S9xDeinitAPU();
|
||||
WinDeleteRecentGamesList ();
|
||||
DeinitS9x();
|
||||
ClearExts();
|
||||
|
||||
#ifdef CHECK_MEMORY_LEAKS
|
||||
_CrtDumpMemoryLeaks();
|
||||
#endif
|
||||
return msg.wParam;
|
||||
DeInitRenderFilters();
|
||||
|
||||
S9xGraphicsDeinit();
|
||||
S9xDeinitAPU();
|
||||
WinDeleteRecentGamesList ();
|
||||
DeinitS9x();
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
void FreezeUnfreezeDialog(bool8 freeze)
|
||||
|
@ -7048,7 +7050,7 @@ void LoadExts(void)
|
|||
curr->compressed=true;
|
||||
if(strlen(buffer)>1)
|
||||
{
|
||||
curr->extension=new TCHAR[strlen(buffer)-1];
|
||||
curr->extension=new TCHAR[strlen(buffer)];
|
||||
_tcsncpy(curr->extension, _tFromChar(buffer), strlen(buffer)-1);
|
||||
curr->extension[strlen(buffer)-1]='\0';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue