use stat without malloc