Reduce a piece of malloc/free.

Signed-off-by: Leo Ma <leoma@credosemi.com>
Merge pull request #5 from leo-ma/master

Reduce a piece of malloc/free.