finished malloc helper functions