From: Nikos Mavrogiannopoulos Date: Sun, 25 May 2014 12:32:35 +0000 (+0200) Subject: cleanup resources on _gnutls_ecc_ansi_x963_export() failure. X-Git-Tag: gnutls_3_3_3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b5f77110f4cfa94b22d2c5a3643da48726db690;p=thirdparty%2Fgnutls.git cleanup resources on _gnutls_ecc_ansi_x963_export() failure. --- 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; }