init with zero any new or reused stun buffers

This commit is contained in:
Mészáros Mihály 2020-06-22 00:08:12 +02:00
parent 2b6556debe
commit 170da11407

View File

@ -293,10 +293,19 @@ static stun_buffer_list_elem *new_blist_elem(ioa_engine_handle e)
if(!ret) {
ret = (stun_buffer_list_elem *)malloc(sizeof(stun_buffer_list_elem));
/* init bzero below will solve all of these in one step
ret->buf.len = 0;
ret->buf.offset = 0;
ret->buf.coffset = 0;
*/
ret->next = NULL;
if (!ret) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot allocate memory for STUN buffer!\n", __FUNCTION__);
}
}
if(ret) {
bzero(&ret->buf, sizeof(stun_buffer));
}
return ret;