diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-07-12 11:04:34 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-07-12 11:04:34 +0200 |
commit | 017597067e33e3cb5938d49c83c7b60ed2ba773f (patch) | |
tree | 7e9df13f5bc887033308781d8fc488acbd174ec7 | |
parent | c90bddbfc94367fa26d806ea18b0c7314b870e52 (diff) |
mg2d: avoid leaks in mg_dh_init()
-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; |