Merge pull request #47 from Carmot/master

Minor memory issues fixed.
This commit is contained in:
wangyu- 2017-10-26 14:43:00 +08:00 committed by GitHub
commit d6e445f220
3 changed files with 10 additions and 1 deletions

View File

@ -66,7 +66,11 @@ int delay_manager_t::add(my_time_t delay,const dest_t &dest,char *data,int len)
delay_data_t tmp=delay_data;
tmp.data=(char *)malloc(delay_data.len+100);
if(!tmp.data)
{
mylog(log_warn, "malloc() returned null in delay_manager_t::add()");
return -1;
}
memcpy(tmp.data,data,delay_data.len);
my_time_t tmp_time=get_current_time_us();

View File

@ -51,6 +51,10 @@ void* get_code(int k,int n)
if (table==0)
{
table=(void* (*)[256]) malloc(sizeof(void*)*256*256);
if(!table)
{
return table;
}
memset(table,0,sizeof(void*)*256*256);
}
if(table[k][n]==0)

View File

@ -704,6 +704,7 @@ int client_event_loop()
}
delay_manager.check();
}
delete &conn_info;
return 0;
}