summaryrefslogtreecommitdiff
path: root/lib/gnutls_mpi.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@crystal.(none)>2008-09-23 20:24:10 +0300
committerNikos Mavrogiannopoulos <nmav@crystal.(none)>2008-09-23 20:24:10 +0300
commitbb3bc56370e3b291219695bec5d4e1cbfc3241be (patch)
tree79c3cdfcaea140e291e2e9d0936a2dae608a713e /lib/gnutls_mpi.c
parent2799333ff7aed352622419180bba878b33dede19 (diff)
downloadgnutls-bb3bc56370e3b291219695bec5d4e1cbfc3241be.tar.gz
Corrected several memory leaks reported by Sam. In some cases switched
to C99 to avoid having complex code.
Diffstat (limited to 'lib/gnutls_mpi.c')
-rw-r--r--lib/gnutls_mpi.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index d31437856b..90763e1679 100644
--- a/lib/gnutls_mpi.c
+++ b/lib/gnutls_mpi.c
@@ -43,17 +43,10 @@ bigint_t
_gnutls_mpi_randomize (bigint_t r, unsigned int bits,
gnutls_rnd_level_t level)
{
- opaque *buf = NULL;
int size = 1 + (bits / 8), ret;
int rem, i;
bigint_t tmp;
-
- buf = gnutls_malloc (size);
- if (buf == NULL)
- {
- gnutls_assert ();
- return NULL;
- }
+ opaque buf[size];
ret = _gnutls_rnd (level, buf, size);
if (ret < 0)
@@ -92,7 +85,6 @@ _gnutls_mpi_randomize (bigint_t r, unsigned int bits,
return tmp;
cleanup:
- gnutls_free (buf);
return NULL;
}