CppCheck is calling this "Memory leak: ptr" on the line marked "****" below. The purpose of the function is to create and object and return it, so it's okay that it doesn't delete the object that is created. Is that all that CppCheck is reacting to? Weird then that it was on that line and not the others. Or is there something else it is saying?
CppCheck is calling this "Memory leak: ptr" on the line marked "****" below. The purpose of the function is to create and object and return it, so it's okay that it doesn't delete the object that is created. Is that all that CppCheck is reacting to? Weird then that it was on that line and not the others. Or is there something else it is saying?
Thank you.
Last edit: Chris Rice 2022-08-06
It looks like a memory leak to me. The
result
that you return is NULL right? Andptr
is not NULL.