Skip to content

Fix memory leaks by deallocating structs correctly

Johannes Hayeß requested to merge fix_memory_leaks into master

As it is right now the pointer is incorrectly casted on deallocation, resulting in memory leaks on each allocation-deallocation cycle of a struct.

The solution is to keep track of the same pointer but as different types, one for the struct generated by bindgen and one for the buffer that is used for passing the data to libolm. On deallocation we add the boxed bindgen struct to the scope again, which then gets automatically deallocated.

Merge request reports