diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-25 11:55:10 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-04-25 15:15:31 +0200 |
commit | 3705bd5fe194063c3479ecf5e8c522bfa5803d25 (patch) | |
tree | 2a33d69f78686a8ab536aa52ff13817fe22b292d /lib/x509_b64.c | |
parent | b58f53d4d7cbd6d66ce2b5d186b2cba321a77ee9 (diff) | |
download | gnutls-3705bd5fe194063c3479ecf5e8c522bfa5803d25.tar.gz |
_gnutls_base64_decode: corrected leak on decoding error
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/x509_b64.c')
-rw-r--r-- | lib/x509_b64.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/x509_b64.c b/lib/x509_b64.c index 884f4da481..340724c4d7 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -272,23 +272,26 @@ _gnutls_base64_decode(const uint8_t * data, size_t data_size, pdata.size, pdata.data); if (ret == 0) { gnutls_assert(); - gnutls_free(result->data); - result->data = NULL; ret = GNUTLS_E_PARSING_ERROR; - goto cleanup; + goto fail; } ret = base64_decode_final(&ctx); if (ret != 1) { ret = gnutls_assert_val(GNUTLS_E_PARSING_ERROR); - goto cleanup; + goto fail; } result->size = size; ret = size; + goto cleanup; + + fail: + gnutls_free(result->data); + result->data = NULL; - cleanup: + cleanup: gnutls_free(pdata.data); return ret; } |