freeing mallocs of threads and clocks