Skip to content

Commit

Permalink
Avoid deallocating a shape that is added to shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow committed Feb 12, 2021
1 parent 9173980 commit 3d2c6cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tiny_obj_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2749,6 +2749,9 @@ bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
.size()) { // FIXME(syoyo): Support other prims(e.g. lines)
shapes->push_back(shape);
}
// `shape` will be deallocated, so make sure it's not one of the ones we've
// added to `shapes`.
shape = shape_t();
prim_group.clear(); // for safety

if (err) {
Expand Down

0 comments on commit 3d2c6cd

Please sign in to comment.