Fixed various memory issues. (bug 5766, r=asherkin)
This commit is contained in:
parent
3d4e1ffd64
commit
86c699dd36
@ -304,14 +304,19 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
|
|||||||
delete pConVarList;
|
delete pConVarList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const IPluginRuntime * pRuntime = plugin->GetRuntime();
|
||||||
|
|
||||||
/* Remove convar queries for this plugin that haven't returned results yet */
|
/* Remove convar queries for this plugin that haven't returned results yet */
|
||||||
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
|
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
|
||||||
{
|
{
|
||||||
ConVarQuery &query = (*iter);
|
ConVarQuery &query = (*iter);
|
||||||
if (query.pCallback->GetParentRuntime() == plugin->GetRuntime())
|
if (query.pCallback->GetParentRuntime() == pRuntime)
|
||||||
{
|
{
|
||||||
m_ConVarQueries.erase(iter);
|
iter = m_ConVarQueries.erase(iter);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ bool CForward::RemoveFunction(IPluginFunction *func)
|
|||||||
lst = &m_paused;
|
lst = &m_paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
|
for (iter=lst->begin(); iter!=lst->end(); iter++)
|
||||||
{
|
{
|
||||||
if ((*iter) == func)
|
if ((*iter) == func)
|
||||||
{
|
{
|
||||||
|
@ -2605,10 +2605,12 @@ SMPlugin *CPluginManager::FindPluginByConsoleArg(const char *arg)
|
|||||||
smcore.Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
smcore.Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||||
|
|
||||||
CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile);
|
CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile);
|
||||||
if (!pluginpp || !*pluginpp)
|
if (!pluginpp)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pl = *pluginpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pl;
|
return pl;
|
||||||
|
@ -171,14 +171,13 @@ MD5::MD5(FILE *file){
|
|||||||
|
|
||||||
unsigned char *MD5::raw_digest(){
|
unsigned char *MD5::raw_digest(){
|
||||||
|
|
||||||
uint1 *s = new uint1[16];
|
|
||||||
|
|
||||||
if (!finalized){
|
if (!finalized){
|
||||||
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
||||||
"finalized the digest!" <<endl;*/
|
"finalized the digest!" <<endl;*/
|
||||||
return ( (unsigned char*) "");
|
return ( (unsigned char*) "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint1 *s = new uint1[16];
|
||||||
memcpy(s, digest, 16);
|
memcpy(s, digest, 16);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -171,14 +171,13 @@ MD5::MD5(FILE *file){
|
|||||||
|
|
||||||
unsigned char *MD5::raw_digest(){
|
unsigned char *MD5::raw_digest(){
|
||||||
|
|
||||||
uint1 *s = new uint1[16];
|
|
||||||
|
|
||||||
if (!finalized){
|
if (!finalized){
|
||||||
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
||||||
"finalized the digest!" <<endl;*/
|
"finalized the digest!" <<endl;*/
|
||||||
return ( (unsigned char*) "");
|
return ( (unsigned char*) "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint1 *s = new uint1[16];
|
||||||
memcpy(s, digest, 16);
|
memcpy(s, digest, 16);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -171,14 +171,13 @@ MD5::MD5(FILE *file){
|
|||||||
|
|
||||||
unsigned char *MD5::raw_digest(){
|
unsigned char *MD5::raw_digest(){
|
||||||
|
|
||||||
uint1 *s = new uint1[16];
|
|
||||||
|
|
||||||
if (!finalized){
|
if (!finalized){
|
||||||
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
|
||||||
"finalized the digest!" <<endl;*/
|
"finalized the digest!" <<endl;*/
|
||||||
return ( (unsigned char*) "");
|
return ( (unsigned char*) "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint1 *s = new uint1[16];
|
||||||
memcpy(s, digest, 16);
|
memcpy(s, digest, 16);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -198,15 +197,15 @@ unsigned char *MD5::raw_digest(unsigned char buffer[16])
|
|||||||
|
|
||||||
char *MD5::hex_digest(){
|
char *MD5::hex_digest(){
|
||||||
|
|
||||||
int i;
|
|
||||||
char *s= new char[33];
|
|
||||||
|
|
||||||
if (!finalized){
|
if (!finalized){
|
||||||
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
|
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
|
||||||
"finalized the digest!" <<endl;*/
|
"finalized the digest!" <<endl;*/
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
|
char *s= new char[33];
|
||||||
|
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
sprintf(s+i*2, "%02x", digest[i]);
|
sprintf(s+i*2, "%02x", digest[i]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user