"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/memory_stats.c" between
snort-2.9.16.1.tar.gz and snort-2.9.17.tar.gz

About: Snort is a network intrusion prevention and detection system (IDS/IPS) combining the benefits of signature, protocol and anomaly-based inspection.

memory_stats.c  (snort-2.9.16.1):memory_stats.c  (snort-2.9.17)
skipping to change at line 94 skipping to change at line 94
void MemoryPostFunction(uint16_t type, void *old_context, struct _THREAD_ELEMENT *te, ControlDataSendFunc f) void MemoryPostFunction(uint16_t type, void *old_context, struct _THREAD_ELEMENT *te, ControlDataSendFunc f)
{ {
char *buffer = (char*) calloc(MEM_STATS_BUF_SIZE + 1, 1); char *buffer = (char*) calloc(MEM_STATS_BUF_SIZE + 1, 1);
uint32_t preproc_id; uint32_t preproc_id;
if(old_context) if(old_context)
{ {
preproc_id = *((uint32_t *) old_context); preproc_id = *((uint32_t *) old_context);
PreprocDisplaystats(buffer, preproc_id); PreprocDisplaystats(buffer, preproc_id);
if(-1 == f(te, (const uint8_t *)buffer, strlen(buffer))) if (-1 == f(te, (const uint8_t *)buffer, strlen(buffer)))
LogMessage("Unable to send data to the frontend\n"); LogMessage("Unable to send data to the frontend\n");
} }
free(buffer);
} }
int MemoryControlFunction(uint16_t type, void *new_context, void **old_context) int MemoryControlFunction(uint16_t type, void *new_context, void **old_context)
{ {
if(new_context) if(new_context)
*old_context = new_context; *old_context = new_context;
else else
LogMessage("\nnew_context is NULL\n"); LogMessage("\nnew_context is NULL\n");
return 0; return 0;
} }
skipping to change at line 144 skipping to change at line 145
} }
void* SnortPreprocAlloc (int num, unsigned long size, uint32_t preproc, bool cfg ) void* SnortPreprocAlloc (int num, unsigned long size, uint32_t preproc, bool cfg )
{ {
void *pv = calloc(num, size); void *pv = calloc(num, size);
if ( pv ) if ( pv )
{ {
if (preproc_mem_info[preproc] == 0) if (preproc_mem_info[preproc] == 0)
{ {
LogMessage("Memory stats information for preprocessor is NULL");
return pv; return pv;
} }
if (cfg) if (cfg)
{ {
preproc_mem_info[preproc]->cfg_memory.used_memory += size; preproc_mem_info[preproc]->cfg_memory.used_memory += size;
preproc_mem_info[preproc]->cfg_memory.num_of_alloc++; preproc_mem_info[preproc]->cfg_memory.num_of_alloc++;
} }
else else
{ {
skipping to change at line 178 skipping to change at line 178
void SnortPreprocFree (void *ptr, uint32_t size, uint32_t preproc, bool cfg) void SnortPreprocFree (void *ptr, uint32_t size, uint32_t preproc, bool cfg)
{ {
if( ptr ) if( ptr )
{ {
free(ptr); free(ptr);
ptr = NULL; ptr = NULL;
} }
if (preproc_mem_info[preproc] == NULL) if (preproc_mem_info[preproc] == NULL)
{ {
LogMessage("Memory stats information for preprocessor is NULL");
return; return;
} }
if (cfg) if (cfg)
{ {
preproc_mem_info[preproc]->cfg_memory.used_memory -= size; preproc_mem_info[preproc]->cfg_memory.used_memory -= size;
preproc_mem_info[preproc]->cfg_memory.num_of_free++; preproc_mem_info[preproc]->cfg_memory.num_of_free++;
} }
else else
{ {
preproc_mem_info[preproc]->session_memory.used_memory -= size; preproc_mem_info[preproc]->session_memory.used_memory -= size;
 End of changes. 4 change blocks. 
3 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)