Finalize :
-documentation added
-checked for redundancy
-free all the malloc to avoid memory leak : bad memory access
-naming for test and function changed
-comment added for some function
-test coverage tested
-bug fixed

Signed-off-by: 9drashijin <9drashijin@live.com>