summaryrefslogtreecommitdiff
path: root/lib/x509/pkcs12.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-25 10:48:46 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-04-25 10:48:46 +0200
commitee7d08b18fd759344c10171f2f561125cfe619e5 (patch)
treee87833772859f980e06478c2c65112781b012c0e /lib/x509/pkcs12.c
parent3202ab340cfa3b758806ddb6d909af05c1c631d4 (diff)
downloadgnutls-ee7d08b18fd759344c10171f2f561125cfe619e5.tar.gz
cleanups in _pkcs12_decode_safe_contents
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/x509/pkcs12.c')
-rw-r--r--lib/x509/pkcs12.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index 00e16d4c66..13619adf1d 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -492,6 +492,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
(ASN1_ETYPE_OCTET_STRING,
attr_val.data, attr_val.size,
&t, 1);
+
_gnutls_free_datum(&attr_val);
if (result < 0) {
gnutls_assert();
@@ -501,11 +502,8 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
continue;
}
- attr_val.data = t.data;
- attr_val.size = t.size;
-
- bag->element[i].local_key_id =
- attr_val;
+ bag->element[i].local_key_id.data = t.data;
+ bag->element[i].local_key_id.size = t.size;
} else if (strcmp(oid, FRIENDLY_NAME_OID)
== 0) {
result =
@@ -513,6 +511,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
(ASN1_ETYPE_BMP_STRING,
attr_val.data, attr_val.size,
&t, 1);
+
_gnutls_free_datum(&attr_val);
if (result < 0) {
gnutls_assert();
@@ -522,11 +521,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
continue;
}
- attr_val.data = t.data;
- attr_val.size = t.size;
-
- bag->element[i].friendly_name =
- (char *) t.data;
+ bag->element[i].friendly_name = (char *) t.data;
} else {
_gnutls_free_datum(&attr_val);
_gnutls_debug_log
@@ -540,10 +535,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum_t * content,
}
- asn1_delete_structure(&c2);
-
-
- return 0;
+ result = 0;
cleanup:
if (c2)