summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}