fixed c++ define
fixed memory leaks
Merge pull request #16 from zerosync/dev_sappo

C++ missing parenthensis and fixed memory leaks