You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function belle_sip_list_remove_link in belle_sip_object.c incorrectly removes list items without freeing their associated memory. This can lead to memory leaks over time, as unused list items accumulate but are not properly deallocated.
Expected Behavior:
The function should remove the specified list item and free its memory to prevent memory leaks. To achieve this, the correct function to use is belle_sip_list_delete_link. This function both removes the item from the list and frees its memory.
belle_sip_object.c
intbelle_sip_object_data_remove(belle_sip_object_t*obj, constchar*name) {
belle_sip_list_t*list_entry=belle_sip_list_find_custom(obj->data_store, belle_sip_object_data_find, name);
structbelle_sip_object_data*entry= (list_entry) ? list_entry->data : NULL;
if (entry) {
belle_sip_free(entry->name);
if (entry->destroy_func) entry->destroy_func(entry->data);
belle_sip_free(entry);
}
if (list_entry) obj->data_store=belle_sip_list_remove_link(obj->data_store, list_entry);
return !(list_entry!=NULL);
}
Description:
The function
belle_sip_list_remove_link
in belle_sip_object.c incorrectly removes list items without freeing their associated memory. This can lead to memory leaks over time, as unused list items accumulate but are not properly deallocated.Expected Behavior:
The function should remove the specified list item and free its memory to prevent memory leaks. To achieve this, the correct function to use is
belle_sip_list_delete_link
. This function both removes the item from the list and frees its memory.belle_sip_object.c
in belle-sip/include/belle-sip/list.h
in bctoolbox/src/containers/list.c
The text was updated successfully, but these errors were encountered: