summaryrefslogtreecommitdiff
path: root/lib/x509
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-08-04 17:32:16 +0200
committerSimon Josefsson <simon@josefsson.org>2009-08-04 17:32:16 +0200
commitfc5e2726e80e845c44a5ecacd0c5d4f72087d1cd (patch)
treeb55d99af97d2cb4627d58f2cd4eca9aa5bc9e42f /lib/x509
parent449e7d673e4527e5dc92a59be7653741099d4658 (diff)
downloadgnutls-fc5e2726e80e845c44a5ecacd0c5d4f72087d1cd.tar.gz
Simplify and fix mem leak.
Diffstat (limited to 'lib/x509')
-rw-r--r--lib/x509/common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 3ec7509880..ce35b5b068 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -181,7 +181,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
{
char *str, tmpname[128];
const char *ANAME = NULL;
- int CHOICE = -1, len = -1, result, i;
+ int len = -1, result, i;
ASN1_TYPE tmpasn = ASN1_TYPE_EMPTY;
char asn1_err[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = "";
@@ -198,7 +198,6 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
}
ANAME = asn1_find_structure_from_oid (_gnutls_get_pkix (), oid);
- CHOICE = _gnutls_x509_oid_data_choice (oid);
if (ANAME == NULL)
{
@@ -248,6 +247,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
if ((result = asn1_read_value (tmpasn, "", str, &len)) != ASN1_SUCCESS)
{
+ gnutls_free (str);
gnutls_assert ();
asn1_delete_structure (&tmpasn);
return _gnutls_asn2err (result);
@@ -255,7 +255,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
str[len] = '\0';
- if (CHOICE == 0)
+ if (_gnutls_x509_oid_data_choice (oid) == 0)
{
if (res)
_gnutls_str_cpy (res, *res_size, str);
@@ -303,6 +303,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
if ((result =
asn1_read_value (tmpasn, tmpname, str, &len)) != ASN1_SUCCESS)
{
+ gnutls_free (str);
asn1_delete_structure (&tmpasn);
return _gnutls_asn2err (result);
}
@@ -336,6 +337,7 @@ _gnutls_x509_oid_data2string (const char *oid, void *value,
result = _gnutls_x509_data2hex (str, len, res, res_size);
if (result < 0)
{
+ gnutls_free (str);
gnutls_assert ();
return result;
}