problem allocaing memory in char_fsm