fixed bug of malloc