Memory leak and NULL dereference fixes.
[openssl.git] / crypto / asn1 / bio_asn1.c
index dc7efd551c05c99e7a9d1925ef23476544e0fa56..bca4eebf6d3fb62ab8abdfa15398764f983e1321 100644 (file)
@@ -154,7 +154,10 @@ static int asn1_bio_new(BIO *b)
        if (!ctx)
                return 0;
        if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
+               {
+               OPENSSL_free(ctx);
                return 0;
+               }
        b->init = 1;
        b->ptr = (char *)ctx;
        b->flags = 0;