Correct order of free
Put mutex and cond on struct instead of pointers