malloc a local array to avoid SEGMENT FAULT.