Fix memory leaks in tests

7 jobs for develop in 1 minute and 49 seconds (queued for 1 second)