add assert after malloc