Fix memory stomp due to incorrect malloc size.