add memory testing framework and add some sdsfree fixing memory leak

add memory testing framework with own malloc,free etc functions. And add sdsfree to fix some memory leak bug in the main test func.