summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-03-03 14:05:35 +0100
committerAnton Khirnov <anton@khirnov.net>2019-03-04 17:14:07 +0100
commit94a6a28558c8fa40170aee9b89335c1f25885dcc (patch)
treeb3dabf4c8de4e842d00c28930597187ee1352886
parent7f4b62ef082ee18090d00b3cad3bce3c89f5dc71 (diff)
ell_grid_solve: initialize diff_coeffs to 0
Prevents the uninitialized items from affecting interpolation.
-rw-r--r--ell_grid_solve.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ell_grid_solve.c b/ell_grid_solve.c
index 7a883e0..cc2d7e4 100644
--- a/ell_grid_solve.c
+++ b/ell_grid_solve.c
@@ -670,10 +670,9 @@ static int arrays_alloc(EGSContext *ctx, const size_t domain_size[2])
ctx->residual_stride = stride;
for (int i = 0; i < ARRAY_ELEMS(ctx->diff_coeffs); i++) {
- ret = posix_memalign((void**)&priv->diff_coeffs_base[i], 32,
- sizeof(*priv->diff_coeffs_base[i]) * arr_size);
- if (ret != 0)
- return -ret;
+ priv->diff_coeffs_base[i] = calloc(arr_size, sizeof(*priv->diff_coeffs_base));
+ if (!priv->diff_coeffs_base[i])
+ return -ENOMEM;
ctx->diff_coeffs[i] = priv->diff_coeffs_base[i] + start_offset;
}
ctx->diff_coeffs_stride = stride;