diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-15 16:27:51 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-15 16:27:51 +0000 |
commit | ae84a54357ab7e180ba80b4cb90885f052ca335d (patch) | |
tree | ea4b6550d4ec4da54d34ca33999da1f8510802ca /inp_str.c | |
parent | 2a346ee6e6b733b2ec3e0945ee34a4a6bd49a4ab (diff) | |
download | mpfr-ae84a54357ab7e180ba80b4cb90885f052ca335d.tar.gz |
added error message when memory allocation fails
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@878 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'inp_str.c')
-rw-r--r-- | inp_str.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -49,6 +49,10 @@ mpfr_inp_str (rop, stream, base, rnd_mode) alloc_size = 100; str = (char *) (*_mp_allocate_func) (alloc_size); + if (str == NULL) { + fprintf (stderr, "Error in mpfr_inp_str: no more memory available\n"); + exit (1); + } str_size = 0; nread = 0; @@ -67,6 +71,10 @@ mpfr_inp_str (rop, stream, base, rnd_mode) size_t old_alloc_size = alloc_size; alloc_size = alloc_size * 3 / 2; str = (char *) (*_mp_reallocate_func) (str, old_alloc_size, alloc_size); + if (str == NULL) { + fprintf (stderr, "Error in mpfr_inp_str: no more memory available\n"); + exit (1); + } } if (c == EOF || isspace (c)) break; @@ -80,6 +88,10 @@ mpfr_inp_str (rop, stream, base, rnd_mode) size_t old_alloc_size = alloc_size; alloc_size = alloc_size * 3 / 2; str = (char *) (*_mp_reallocate_func) (str, old_alloc_size, alloc_size); + if (str == NULL) { + fprintf (stderr, "Error in mpfr_inp_str: no more memory available\n"); + exit (1); + } } str[str_size] = 0; |