Why is this a memory leak from valgrind?

I am creating a program and while dynamically allocating an integer array, i try to delete the array from the heap in the same function I create it in. But valgrind is saying there are 20 bytes definitely lost/in use at exit. Here is the function: int whoStarts(Parent* parents, int num){ int* connects = new… Read More Why is this a memory leak from valgrind?

Will there still be a memory leak if I don't store the returned ptr?

I was reading this question, and here the jsoncpp CharReaderBuilder::newCharReader() function returns a pointer to a dynamically created CharReader object, which can then be used to parse a JSON. I understand in that question the OP should have freed the returned pointer once it was used, since it was created on the heap. But, I… Read More Will there still be a memory leak if I don't store the returned ptr?