From 79b137ee79e3e9abc46b0a0abe961b951d705ae9 Mon Sep 17 00:00:00 2001 From: tege Date: Sun, 16 Apr 2000 20:02:07 +0200 Subject: Fix memory leakage. --- mpz/inp_str.c | 8 +++++--- 1 file 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; } -- cgit v1.2.1