aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg2d.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mg2d.c b/mg2d.c
index e7ae350..103f514 100644
--- a/mg2d.c
+++ b/mg2d.c
@@ -1044,6 +1044,7 @@ static int mg_dh_init(DomainHierarchy *dh, const DomainGeometry *root,
dg_tmp = realloc(dh->levels, (depth + 1) * sizeof(*dh->levels));
if (!dg_tmp) {
+ mg2di_dg_free(&cur_dg);
ret = -ENOMEM;
goto fail;
}
@@ -1051,6 +1052,7 @@ static int mg_dh_init(DomainHierarchy *dh, const DomainGeometry *root,
stepsizes_tmp = realloc(dh->stepsizes, (depth + 1) * sizeof(*dh->stepsizes));
if (!stepsizes_tmp) {
+ mg2di_dg_free(&cur_dg);
ret = -ENOMEM;
goto fail;
}
@@ -1067,6 +1069,7 @@ static int mg_dh_init(DomainHierarchy *dh, const DomainGeometry *root,
}
fail:
+ mg2di_dg_free(&next_dg);
if (ret < 0)
mg_dh_uninit(dh);
return ret;