diff options
author | Paul Zimmermann <Paul.Zimmermann@inria.fr> | 2018-04-19 20:45:59 +0200 |
---|---|---|
committer | Paul Zimmermann <Paul.Zimmermann@inria.fr> | 2018-04-19 20:45:59 +0200 |
commit | 0576b43a711fb65c0a5e447dcf96081670f85e1e (patch) | |
tree | e1328ace707318689b9f22e743d6dbcee32cd0ab /src/sum.c | |
parent | 0641b55b6a5665b2449c70a6073db722ad15269e (diff) | |
download | mpc-git-0576b43a711fb65c0a5e447dcf96081670f85e1e.tar.gz |
check return value of malloc() is not NULL in mpc_sum
Diffstat (limited to 'src/sum.c')
-rw-r--r-- | src/sum.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -18,6 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/ . */ +#include <stdio.h> /* for MPC_ASSERT */ #include "mpc-impl.h" int @@ -28,6 +29,7 @@ mpc_sum (mpc_ptr sum, const mpc_ptr *z, unsigned long n, mpc_rnd_t rnd) unsigned long i; t = (mpfr_ptr *) malloc (n * sizeof(mpfr_t)); + MPC_ASSERT(t != NULL); for (i = 0; i < n; i++) t[i] = mpc_realref (z[i]); inex_re = mpfr_sum (mpc_realref (sum), t, n, MPC_RND_RE (rnd)); |