mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-12 23:08:03 +03:00
experimental fix for memleak
This commit is contained in:
parent
f2c5a2b85b
commit
6ee7930a46
@ -404,6 +404,7 @@ char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize)
|
||||
pl = new plcache_entry;
|
||||
|
||||
pl->file = new CAmxxReader(file, sizeof(cell));
|
||||
pl->buffer = NULL;
|
||||
if (pl->file->GetStatus() != CAmxxReader::Err_None)
|
||||
{
|
||||
delete pl->file;
|
||||
@ -411,15 +412,14 @@ char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pl->bufsize =pl->file->GetBufferSize();
|
||||
pl->buffer = NULL;
|
||||
pl->bufsize = pl->file->GetBufferSize();
|
||||
if (pl->bufsize)
|
||||
{
|
||||
pl->buffer = new char[pl->bufsize];
|
||||
pl->file->GetSection(pl->buffer);
|
||||
}
|
||||
|
||||
if (!pl->bufsize || pl->file->GetStatus() != CAmxxReader::Err_None)
|
||||
if (!pl->buffer || pl->file->GetStatus() != CAmxxReader::Err_None)
|
||||
{
|
||||
delete [] pl->buffer;
|
||||
delete pl->file;
|
||||
|
Loading…
x
Reference in New Issue
Block a user