arghaffari / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

Memory leak in new C++ version #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I haven't tried the new version yet, but this looks, to me, like it leaks:

380:  int *v1 = new int[v_length];
381:  int *v2 = new int[v_length];

<http://code.google.com/p/google-diff-match-patch/source/browse/trunk/cpp/diff_m
atch_patch.cpp?spec=svn85&r=85#380>

I don't see any `delete [] v1;` or `delete [] v2;`.
After all this is only C++ ... no garbage collectors here ;-).

Original issue reported on code.google.com by chris...@gmail.com on 22 Jan 2011 at 8:50

GoogleCodeExporter commented 9 years ago
Good catch.  Thanks.  A pair of deletes need to be added at all three exit 
points in that function.  I've checked the rest of the codebase and this bug 
appears to be unique.

The change has been sent for code review and will likely be pushed on Monday.

Original comment by neil.fra...@gmail.com on 22 Jan 2011 at 10:08

GoogleCodeExporter commented 9 years ago
Fixed and uploaded to both Subversion and the downloadable package.

Thanks for catching this!

Original comment by neil.fra...@gmail.com on 24 Jan 2011 at 9:16