[OpenSER-Devel] shm_malloc and memset

Henning Westerholt henning.westerholt at 1und1.de
Wed Sep 12 10:39:40 CEST 2007


Hi,

i've a question regarding the usage of shm_malloc in the code. One mysterious 
bug that we're currently debugging was probably caused from a missing 
initialization of the allocated memory with zero.

The code in question: usr_avp.c: destroy_avp_list_unsafe(..)

This functions loops until the next pointer is null. Could it happen on a busy 
server that the memory contains some avp entries from previous operations? It 
seems that then code loops runs away in this case and free some other memory 
blocks.. 

It is advisable to memset(0..) all shm_mem allocation before use? The 
mentioned code is not the only place in the where dynamic structures are 
placed in shared mem that is not correctly initialized.

Could this lead to further problems and should be perhaps fixed in the whole 
code?

Thank you,

Henning



More information about the Devel mailing list