Fixed malloc call / memory issue