implement the merge sort algorithm and fix memory leak of it.

data used in unit test of ex32 now all allocated in heap.