Added check to see if malloc failed and error out if it did