diff options
Diffstat (limited to 'lib/x509_b64.c')
-rw-r--r-- | lib/x509_b64.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/x509_b64.c b/lib/x509_b64.c index 44e3b47a41..884f4da481 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -263,8 +263,10 @@ _gnutls_base64_decode(const uint8_t * data, size_t data_size, size = BASE64_DECODE_LENGTH(data_size); result->data = gnutls_malloc(size); - if (result->data == NULL) - return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + if (result->data == NULL) { + ret = gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + goto cleanup; + } ret = base64_decode_update(&ctx, &size, result->data, pdata.size, pdata.data); @@ -277,8 +279,10 @@ _gnutls_base64_decode(const uint8_t * data, size_t data_size, } ret = base64_decode_final(&ctx); - if (ret != 1) - return gnutls_assert_val(GNUTLS_E_PARSING_ERROR); + if (ret != 1) { + ret = gnutls_assert_val(GNUTLS_E_PARSING_ERROR); + goto cleanup; + } result->size = size; |