Added a simple mutex to malloc and free