Skip to content

Commit

Permalink
free SHPObject when done with it (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
cldellow authored Nov 5, 2023
1 parent 5153a60 commit fcec727
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/read_shp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ void readShapefile(const Box &clippingBox,
if (shapeBox.min_corner().get<0>() > clippingBox.max_corner().get<0>() ||
shapeBox.max_corner().get<0>() < clippingBox.min_corner().get<0>() ||
shapeBox.min_corner().get<1>() > clippingBox.max_corner().get<1>() ||
shapeBox.max_corner().get<1>() < clippingBox.min_corner().get<1>()) { continue; }
shapeBox.max_corner().get<1>() < clippingBox.min_corner().get<1>()) {
SHPDestroyObject(shape);
continue;
}

if (shapeType==1) {
// Points
Expand Down Expand Up @@ -281,6 +284,7 @@ void readShapefile(const Box &clippingBox,
// Not supported
cerr << "Shapefile entity #" << i << " type " << shapeType << " not supported" << endl;
}
SHPDestroyObject(shape);
}

SHPClose(shp);
Expand Down

0 comments on commit fcec727

Please sign in to comment.