]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
_gnutls_krb5_der_to_principal: fixed invalid deinitialization on cleanup
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 May 2016 19:55:07 +0000 (21:55 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 May 2016 19:55:07 +0000 (21:55 +0200)
lib/x509/krb5.c

index 45b71ba2b9936259ce61f3dae6d344dece081707..49096c1e1a03facfc3b24cd317dba41a74e95d04 100644 (file)
@@ -283,6 +283,8 @@ int _gnutls_krb5_der_to_principal(const gnutls_datum * der, gnutls_datum_t *name
        ASN1_TYPE c2 = ASN1_TYPE_EMPTY;
        gnutls_buffer_st str;
 
+       _gnutls_buffer_init(&str);
+
        result = asn1_create_element(_gnutls_get_gnutls_asn(), "GNUTLS.KRB5PrincipalName", &c2);
        if (result != ASN1_SUCCESS) {
                gnutls_assert();
@@ -297,8 +299,6 @@ int _gnutls_krb5_der_to_principal(const gnutls_datum * der, gnutls_datum_t *name
                goto cleanup;
        }
 
-       _gnutls_buffer_init(&str);
-
        ret = principal_to_str(c2, &str);
        if (ret < 0) {
                /* for some reason we cannot convert to a human readable string