diff --git a/delay_manager.cpp b/delay_manager.cpp index 0b16cdf..0fe19ed 100644 --- a/delay_manager.cpp +++ b/delay_manager.cpp @@ -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(); diff --git a/lib/rs.c b/lib/rs.c index 4e5d5ef..20e2279 100644 --- a/lib/rs.c +++ b/lib/rs.c @@ -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) diff --git a/main.cpp b/main.cpp index 0a2cab2..2c3528d 100644 --- a/main.cpp +++ b/main.cpp @@ -704,6 +704,7 @@ int client_event_loop() } delay_manager.check(); } + delete &conn_info; return 0; }