Skip to content

Commit

Permalink
Fix the issue with 2 consecutive tests and deallocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-korous committed Jan 27, 2014
1 parent a63faf0 commit 910c803
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions hermes2d/src/mesh/curved.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,19 @@ namespace Hermes

void Nurbs::unref()
{
if (!--this->ref)
{
delete[] pt;
pt = nullptr;
delete[] kv;
kv = nullptr;
}
if (!--this->ref)
{
if(pt)
{
delete[] pt;
pt = nullptr;
}
if(kv)
{
delete[] kv;
kv = nullptr;
}
}
}

static double lambda_0(double x, double y)
Expand Down Expand Up @@ -332,7 +338,10 @@ namespace Hermes
{
nurbs[i]->unref();
if (nurbs[i]->ref <= 0)
{
delete nurbs[i];
nurbs[i] = nullptr;
}
}
}
}
Expand Down

0 comments on commit 910c803

Please sign in to comment.