Closed nmichael44 closed 2 years ago
Your example here: https://github.com/fpco/inline-c/blob/master/inline-c-cpp/test/tests.hs
in this code:
Hspec.it "Template with pointers" $ do pt <- [C.block| std::vector<int*>* { return new std::vector<int*>(); } |] :: IO (Ptr (StdVector.CStdVector (Ptr C.CInt))) [C.block| void { int *a = new int; *a = 100; $(std::vector<int*>* pt)->push_back(a); std::cout << *((*$(std::vector<int*>* pt))[0]) << std::endl; } |]
is leaking memory. Both the int and the std::vector<int*> need to be deleted.
int
std::vector<int*>
deleted
Your example here: https://github.com/fpco/inline-c/blob/master/inline-c-cpp/test/tests.hs
in this code:
is leaking memory. Both the
int
and thestd::vector<int*>
need to bedeleted
.