Skip to content

Commit

Permalink
Fix 3 memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Mar 3, 2018
1 parent 7568a45 commit 7c0da76
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ The files were adapted to Godot by removing the dependency on b2Math (replacing
it by b2Glue.h) and commenting out some verbose printf calls.
Upstream code has not changed in 10 years, no need to keep track of changes.

Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.

## bullet

Expand Down Expand Up @@ -69,6 +72,9 @@ Files extracted from upstream source:
- all .cpp and .h files in EtcLib/
- README.md, LICENSE, AUTHORS

Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.

## fonts

Expand Down Expand Up @@ -165,6 +171,9 @@ Files extracted from upstream source:

TODO.

Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.

## libtheora

Expand Down
7 changes: 6 additions & 1 deletion thirdparty/b2d_convexdecomp/b2Polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,12 @@ b2Polygon TraceEdge(b2Polygon* p){
if (nodes[j].nConnected == 0) continue;
b2Vec2 diff = nodes[i].position - nodes[j].position;
if (diff.LengthSquared() <= COLLAPSE_DIST_SQR){
if (nActive <= 3) return b2Polygon();
if (nActive <= 3) {
// -- GODOT start --
delete[] nodes;
// -- GODOT end --
return b2Polygon();
}
//printf("Found dupe, %d left\n",nActive);
--nActive;
foundDupe = true;
Expand Down
3 changes: 3 additions & 0 deletions thirdparty/etc2comp/EtcFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ int FilterTwoPass( RGBCOLOR *pSrcImage, int srcWidth, int srcHeight,
pTempImage = (RGBCOLOR *)malloc( destWidth * srcHeight * sizeof(RGBCOLOR) );
if ( pTempImage == NULL )
{
// -- GODOT start --
free( contrib );
// -- GODOT end --
return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion thirdparty/libsimplewebm/libwebm/mkvparser/mkvparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,9 @@ long Segment::DoLoadCluster(long long& pos, long& len) {
pos += cluster_size;

m_pos = pos;

// -- GODOT start --
delete pCluster;
// -- GODOT end --
if (segment_stop > 0 && m_pos > segment_stop)
return E_FILE_FORMAT_INVALID;

Expand Down

0 comments on commit 7c0da76

Please sign in to comment.