diff options
author | tege <tege@gmplib.org> | 2000-04-16 20:02:07 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 2000-04-16 20:02:07 +0200 |
commit | 79b137ee79e3e9abc46b0a0abe961b951d705ae9 (patch) | |
tree | 4f5e60c155c8153dad5e3897ee260216d6b52319 | |
parent | 008d9292e23b3453219e2b0a2f38b7d20f680f1c (diff) | |
download | gmp-79b137ee79e3e9abc46b0a0abe961b951d705ae9.tar.gz |
Fix memory leakage.
-rw-r--r-- | mpz/inp_str.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mpz/inp_str.c b/mpz/inp_str.c index 0120cde40..6545797c3 100644 --- a/mpz/inp_str.c +++ b/mpz/inp_str.c @@ -66,9 +66,6 @@ mpz_inp_str (x, stream, base) if (stream == 0) stream = stdin; - alloc_size = 100; - str = (char *) (*_mp_allocate_func) (alloc_size); - str_size = 0; nread = 0; /* Skip whitespace. */ @@ -122,6 +119,10 @@ mpz_inp_str (x, stream, base) nread++; } + alloc_size = 100; + str = (char *) (*_mp_allocate_func) (alloc_size); + str_size = 0; + for (;;) { int dig; @@ -144,6 +145,7 @@ mpz_inp_str (x, stream, base) if (str_size == 0) { x->_mp_size = 0; + (*_mp_free_func) (str, alloc_size); return nread; } |