diff options
-rw-r--r-- | mg2d.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |