https://bugs.kde.org/show_bug.cgi?id=459047

Tom Hughes <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Memory leak in valgrind     |Incorrect memory leak
                   |memcheck code               |report
                 CC|                            |[email protected]
             Status|REPORTED                    |RESOLVED
         Resolution|---                         |NOT A BUG

--- Comment #3 from Tom Hughes <[email protected]> ---
I'm not sure why you call this a memory leak in valgrind - it's valgrind
reporting a memory leak in your program.

It's also completely correct - you allocate two arrays but only free one.

You allocate an array of double in main, which you assign to testarray, and
that allocation is never freed.

You also allocate an array of pointers to double in divide2DDoubleArray which
you return to main via the subblockdividers reference parameter where is is
storeed in pTestarray.

You then free pTestarray, but that is an array of raw pointers so freeing it
has no effect on the pointers it contains and they remain allocated, so the
fact that the first one points to testarray does not mean testarray gets freed.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to