summaryrefslogtreecommitdiff
path: root/lib/gnutls_mpi.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@crystal.(none)>2008-09-27 21:01:02 +0300
committerNikos Mavrogiannopoulos <nmav@crystal.(none)>2008-09-27 21:01:02 +0300
commit2079a64d4fb65a0e62e1b361d2200860aa52af18 (patch)
tree7f6a01337b50ffc48b3271b3afbc5caba2b486b9 /lib/gnutls_mpi.c
parent0ab6c5faf197c3e45927f9e878e9d08bdc10ad44 (diff)
downloadgnutls-2079a64d4fb65a0e62e1b361d2200860aa52af18.tar.gz
Revert "Revert C99 uses. Fixes gnutls_mpi.c mem leak, but not others."
This reverts commit bdfa289133b15ad7d92eb3151ce86cca4c879426.
Diffstat (limited to 'lib/gnutls_mpi.c')
-rw-r--r--lib/gnutls_mpi.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c
index 7ba6c8910c..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)
@@ -82,8 +75,6 @@ _gnutls_mpi_randomize (bigint_t r, unsigned int bits,
goto cleanup;
}
- gnutls_free (buf);
-
if (r != NULL)
{
_gnutls_mpi_set (r, tmp);
@@ -94,7 +85,6 @@ _gnutls_mpi_randomize (bigint_t r, unsigned int bits,
return tmp;
cleanup:
- gnutls_free (buf);
return NULL;
}