added one function,

 another way to alloc memory through function .
minor fix