summaryrefslogtreecommitdiff
path: root/lib/x509_b64.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-25 11:55:10 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-25 15:15:31 +0200
commit3705bd5fe194063c3479ecf5e8c522bfa5803d25 (patch)
tree2a33d69f78686a8ab536aa52ff13817fe22b292d /lib/x509_b64.c
parentb58f53d4d7cbd6d66ce2b5d186b2cba321a77ee9 (diff)
downloadgnutls-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.c13
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;
}