summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-25 14:32:35 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-05-29 19:00:02 +0200
commit8b5f77110f4cfa94b22d2c5a3643da48726db690 (patch)
tree2247f07a03c223dcb1a7d6f74633c6dd7eb94027 /lib
parente9088d7cc1f05e3a15fe145fb821fc54bb7842fb (diff)
downloadgnutls-8b5f77110f4cfa94b22d2c5a3643da48726db690.tar.gz
cleanup resources on _gnutls_ecc_ansi_x963_export() failure.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnutls_ecc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gnutls_ecc.c b/lib/gnutls_ecc.c
index 00f7a92d78..847f0d2e85 100644
--- a/lib/gnutls_ecc.c
+++ b/lib/gnutls_ecc.c
@@ -57,8 +57,10 @@ _gnutls_ecc_ansi_x963_export(gnutls_ecc_curve_t curve, bigint_t x,
ret =
_gnutls_mpi_print(x, &out->data[1 + (numlen - byte_size)],
&size);
- if (ret < 0)
- return gnutls_assert_val(ret);
+ if (ret < 0) {
+ gnutls_assert();
+ goto cleanup;
+ }
byte_size = (_gnutls_mpi_get_nbits(y) + 7) / 8;
size = out->size - (1 + (numlen + numlen - byte_size));
@@ -66,11 +68,16 @@ _gnutls_ecc_ansi_x963_export(gnutls_ecc_curve_t curve, bigint_t x,
_gnutls_mpi_print(y,
&out->data[1 + numlen + numlen - byte_size],
&size);
- if (ret < 0)
- return gnutls_assert_val(ret);
+ if (ret < 0) {
+ gnutls_assert();
+ goto cleanup;
+ }
/* pad and store y */
return 0;
+ cleanup:
+ _gnutls_free_datum(out);
+ return ret;
}