CADbloke / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak in new C++ version

GoogleCodeExporter opened this issue · comments

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

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

  • Changed state: Started
  • Added labels: ****
  • Removed labels: ****
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

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****