"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/file-process/file_mempool.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.

file_mempool.c  (snort-2.9.16.1):file_mempool.c  (snort-2.9.17)
skipping to change at line 218 skipping to change at line 218
if(cbuffer_read(mempool->free_list, &b)) if(cbuffer_read(mempool->free_list, &b))
{ {
if(cbuffer_read(mempool->released_list, &b)) if(cbuffer_read(mempool->released_list, &b))
{ {
return NULL; return NULL;
} }
} }
if (*(MagicType *)b != ((uint64_t)FREE_MAGIC)) if (*(MagicType *)b != ((uint64_t)FREE_MAGIC))
{ {
ErrorMessage("%s(%d) safe_mempool_alloc(): Allocation errors! \n", ErrorMessage("%s(%d) safe_mempool_alloc(): Possible memory corruption! \ n",
__FILE__, __LINE__); __FILE__, __LINE__);
} }
DEBUG_WRAP(safe_mempool_verify(mempool);); DEBUG_WRAP(safe_mempool_verify(mempool););
return b; return b;
} }
/* /*
* Free a new object from the buffer * Free a new object from the buffer
skipping to change at line 244 skipping to change at line 244
* *
* Return: * Return:
* SAFE_MEM_SUCCESS * SAFE_MEM_SUCCESS
* SAFE_MEM_FAIL * SAFE_MEM_FAIL
*/ */
static inline int _safe__mempool_remove(CircularBuffer *cb, void *obj) static inline int _safe__mempool_remove(CircularBuffer *cb, void *obj)
{ {
if (obj == NULL) if (obj == NULL)
return SAFE_MEM_FAIL; return SAFE_MEM_FAIL;
if(cbuffer_write(cb, obj)) if (*(MagicType *)obj == ((uint64_t)FREE_MAGIC))
{ {
DEBUG_WRAP(ErrorMessage("%s(%d) safe_mempool_remove(): Double free! \n",
__FILE__, __LINE__););
return SAFE_MEM_FAIL; return SAFE_MEM_FAIL;
} }
if (*(MagicType *)obj == ((uint64_t)FREE_MAGIC)) if (cbuffer_write(cb, obj))
{ {
DEBUG_WRAP(ErrorMessage("%s(%d) safe_mempool_remove(): Double free! \n",
__FILE__, __LINE__););
return SAFE_MEM_FAIL; return SAFE_MEM_FAIL;
} }
*(MagicType *)obj = (uint64_t)FREE_MAGIC; *(MagicType *)obj = (uint64_t)FREE_MAGIC;
return SAFE_MEM_SUCCESS; return SAFE_MEM_SUCCESS;
} }
/* /*
* Free a new object from the SafeMemPool * Free a new object from the SafeMemPool
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

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