Fixing leaks

This was causing leaks every time an event is reported, leaking all the contents in those data structures, which ends up being a lot of memory