fix memory leaks and add a new demo
update demo testcase