[test] Freeing memory during unittests