From 4936eb2786993224985b6931136e1b118d6d29ee Mon Sep 17 00:00:00 2001 From: Jian Guan Date: Mon, 25 Jan 2021 16:46:20 -0800 Subject: [PATCH] Clean MSan warnings 1. Changed to `calloc` to create and initialize arrays. 2. Initialized `info` before using. --- check.h | 2 +- harminv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/check.h b/check.h index 99425cf..ad40903 100644 --- a/check.h +++ b/check.h @@ -29,7 +29,7 @@ #define CHK_MALLOC(p, t, n) do { \ size_t CHK_MALLOC_n_tmp = (n); \ - (p) = (t *) malloc(sizeof(t) * CHK_MALLOC_n_tmp); \ + (p) = (t *) calloc(CHK_MALLOC_n_tmp, sizeof(t)); \ CHECK((p) || CHK_MALLOC_n_tmp == 0, "out of memory!"); \ } while (0) diff --git a/harminv.c b/harminv.c index f115923..7c94038 100644 --- a/harminv.c +++ b/harminv.c @@ -460,7 +460,7 @@ static cmplx symmetric_dot(int n, cmplx *x, cmplx *y) conjugation). */ static void solve_eigenvects(int n, const cmplx *A0, cmplx *V, cmplx *v) { - int lwork, info; + int lwork, info = 0; cmplx *work; double *rwork; cmplx *A;