Fix use after free bug.
authorIstvan Noszticzius <istvan.noszticzius@oracle.com>
Fri, 15 Aug 2014 15:43:28 +0000 (16:43 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 15 Aug 2014 15:50:16 +0000 (16:50 +0100)
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
crypto/x509v3/v3_utl.c

index 75efd99..10a7aa8 100644 (file)
@@ -879,9 +879,9 @@ static int do_check_string(ASN1_STRING *a, int cmp_type, equal_fn equal,
                if (astrlen < 0)
                        return -1;
                rv = equal(astr, astrlen, (unsigned char *)b, blen, flags);
-               OPENSSL_free(astr);
                if (rv > 0 && peername)
                        *peername = BUF_strndup((char *)astr, astrlen);
+               OPENSSL_free(astr);
                }
        return rv;
        }