crypto/pem/pem_info.c:136: error: MEMORY_LEAK
  memory dynamically allocated by call to `X509_INFO_new()` at line 60, column 15 is not reachable after line 136, column 27.
Showing all 82 steps of the trace


crypto/pem/pem_info.c:38:1: start of procedure PEM_X509_INFO_read_bio()
36.   #endif
37.   
38. > STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
39.                                               pem_password_cb *cb, void *u)
40.   {

crypto/pem/pem_info.c:41:5: 
39.                                               pem_password_cb *cb, void *u)
40.   {
41. >     X509_INFO *xi = NULL;
42.       char *name = NULL, *header = NULL;
43.       void *pp;

crypto/pem/pem_info.c:42:5: 
40.   {
41.       X509_INFO *xi = NULL;
42. >     char *name = NULL, *header = NULL;
43.       void *pp;
44.       unsigned char *data = NULL;

crypto/pem/pem_info.c:44:5: 
42.       char *name = NULL, *header = NULL;
43.       void *pp;
44. >     unsigned char *data = NULL;
45.       const unsigned char *p;
46.       long len, error = 0;

crypto/pem/pem_info.c:46:5: 
44.       unsigned char *data = NULL;
45.       const unsigned char *p;
46. >     long len, error = 0;
47.       int ok = 0;
48.       STACK_OF(X509_INFO) *ret = NULL;

crypto/pem/pem_info.c:47:5: 
45.       const unsigned char *p;
46.       long len, error = 0;
47. >     int ok = 0;
48.       STACK_OF(X509_INFO) *ret = NULL;
49.       unsigned int i, raw, ptype;

crypto/pem/pem_info.c:48:5: 
46.       long len, error = 0;
47.       int ok = 0;
48. >     STACK_OF(X509_INFO) *ret = NULL;
49.       unsigned int i, raw, ptype;
50.       d2i_of_void *d2i = 0;

crypto/pem/pem_info.c:50:5: 
48.       STACK_OF(X509_INFO) *ret = NULL;
49.       unsigned int i, raw, ptype;
50. >     d2i_of_void *d2i = 0;
51.   
52.       if (sk == NULL) {

crypto/pem/pem_info.c:52:9: Taking true branch
50.       d2i_of_void *d2i = 0;
51.   
52.       if (sk == NULL) {
              ^
53.           if ((ret = sk_X509_INFO_new_null()) == NULL) {
54.               PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_MALLOC_FAILURE);

crypto/pem/pem_info.c:53:13: 
51.   
52.       if (sk == NULL) {
53. >         if ((ret = sk_X509_INFO_new_null()) == NULL) {
54.               PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_MALLOC_FAILURE);
55.               goto err;

include/openssl/x509.h:252:1: start of procedure sk_X509_INFO_new_null()
  250.   } X509_INFO;
  251.   
  252. > DEFINE_STACK_OF(X509_INFO)
  253.   
  254.   /*

crypto/stack/stack.c:99:1: start of procedure OPENSSL_sk_new_null()
    97.   }
    98.   
    99. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);

crypto/stack/stack.c:101:5: Skipping OPENSSL_sk_new(): empty list of specs
    99.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
               ^
    102.   }
    103.   

crypto/stack/stack.c:102:1: return from a call to OPENSSL_sk_new_null
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
    102. > }
    103.   
    104.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

include/openssl/x509.h:252:1: return from a call to sk_X509_INFO_new_null
  250.   } X509_INFO;
  251.   
  252. > DEFINE_STACK_OF(X509_INFO)
  253.   
  254.   /*

crypto/pem/pem_info.c:53:13: Taking false branch
51.   
52.       if (sk == NULL) {
53.           if ((ret = sk_X509_INFO_new_null()) == NULL) {
                  ^
54.               PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_MALLOC_FAILURE);
55.               goto err;

crypto/pem/pem_info.c:60:9: 
58.           ret = sk;
59.   
60. >     if ((xi = X509_INFO_new()) == NULL)
61.           goto err;
62.       for (;;) {

crypto/asn1/x_info.c:16:1: start of procedure X509_INFO_new()
  14.   #include <openssl/x509.h>
  15.   
  16. > X509_INFO *X509_INFO_new(void)
  17.   {
  18.       X509_INFO *ret;

crypto/asn1/x_info.c:20:5: 
  18.       X509_INFO *ret;
  19.   
  20. >     ret = OPENSSL_zalloc(sizeof(*ret));
  21.       if (ret == NULL) {
  22.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:5: 
    186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188. >     void *ret = CRYPTO_malloc(num, file, line);
    189.   
    190.       FAILTEST();

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
      156.   #endif
      157.   
      158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160.       void *ret = NULL;

crypto/mem.c:160:5: 
      158.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160. >     void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:162:9: Taking false branch
      160.       void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      163.           return malloc_impl(num, file, line);
      164.   

crypto/mem.c:165:9: Taking false branch
      163.           return malloc_impl(num, file, line);
      164.   
      165.       if (num == 0)
                     ^
      166.           return NULL;
      167.   

crypto/mem.c:169:5: 
      167.   
      168.       FAILTEST();
      169. >     allow_customize = 0;
      170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:179:24: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:180:5: 
      178.   #else
      179.       osslargused(file); osslargused(line);
      180. >     ret = malloc(num);
      181.   #endif
      182.   

crypto/mem.c:183:5: 
      181.   #endif
      182.   
      183. >     return ret;
      184.   }
      185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
      182.   
      183.       return ret;
      184. > }
      185.   
      186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:191:9: Taking true branch
    189.   
    190.       FAILTEST();
    191.       if (ret != NULL)
                   ^
    192.           memset(ret, 0, num);
    193.       return ret;

crypto/mem.c:192:9: 
    190.       FAILTEST();
    191.       if (ret != NULL)
    192. >         memset(ret, 0, num);
    193.       return ret;
    194.   }

crypto/mem.c:193:5: 
    191.       if (ret != NULL)
    192.           memset(ret, 0, num);
    193. >     return ret;
    194.   }
    195.   

crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
    192.           memset(ret, 0, num);
    193.       return ret;
    194. > }
    195.   
    196.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/x_info.c:21:9: Taking false branch
  19.   
  20.       ret = OPENSSL_zalloc(sizeof(*ret));
  21.       if (ret == NULL) {
                ^
  22.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);
  23.           return NULL;

crypto/asn1/x_info.c:26:5: 
  24.       }
  25.   
  26. >     return ret;
  27.   }
  28.   

crypto/asn1/x_info.c:27:1: return from a call to X509_INFO_new
  25.   
  26.       return ret;
  27. > }
  28.   
  29.   void X509_INFO_free(X509_INFO *x)

crypto/pem/pem_info.c:60:9: Taking false branch
58.           ret = sk;
59.   
60.       if ((xi = X509_INFO_new()) == NULL)
              ^
61.           goto err;
62.       for (;;) {

crypto/pem/pem_info.c:215:5: Loop condition is true. Entering loop body
213.           OPENSSL_free(data);
214.           data = NULL;
215.       }
           ^
216.   
217.       /*

crypto/pem/pem_info.c:63:9: 
61.           goto err;
62.       for (;;) {
63. >         raw = 0;
64.           ptype = 0;
65.           i = PEM_read_bio(bp, &name, &header, &data, &len);

crypto/pem/pem_info.c:64:9: 
62.       for (;;) {
63.           raw = 0;
64. >         ptype = 0;
65.           i = PEM_read_bio(bp, &name, &header, &data, &len);
66.           if (i == 0) {

crypto/pem/pem_info.c:65:9: Skipping PEM_read_bio(): empty list of specs
63.           raw = 0;
64.           ptype = 0;
65.           i = PEM_read_bio(bp, &name, &header, &data, &len);
              ^
66.           if (i == 0) {
67.               error = ERR_GET_REASON(ERR_peek_last_error());

crypto/pem/pem_info.c:66:13: Taking false branch
64.           ptype = 0;
65.           i = PEM_read_bio(bp, &name, &header, &data, &len);
66.           if (i == 0) {
                  ^
67.               error = ERR_GET_REASON(ERR_peek_last_error());
68.               if (error == PEM_R_NO_START_LINE) {

crypto/pem/pem_info.c:83:17: 
81.                   if ((xi = X509_INFO_new()) == NULL)
82.                       goto err;
83. >                 goto start;
84.               }
85.               pp = &(xi->x509);

crypto/pem/pem_info.c:75:14: Taking false branch
73.           }
74.    start:
75.           if ((strcmp(name, PEM_STRING_X509) == 0) ||
                   ^
76.               (strcmp(name, PEM_STRING_X509_OLD) == 0)) {
77.               d2i = (D2I_OF(void)) d2i_X509;

crypto/pem/pem_info.c:76:14: Taking false branch
74.    start:
75.           if ((strcmp(name, PEM_STRING_X509) == 0) ||
76.               (strcmp(name, PEM_STRING_X509_OLD) == 0)) {
                   ^
77.               d2i = (D2I_OF(void)) d2i_X509;
78.               if (xi->x509 != NULL) {

crypto/pem/pem_info.c:86:21: Taking false branch
84.               }
85.               pp = &(xi->x509);
86.           } else if ((strcmp(name, PEM_STRING_X509_TRUSTED) == 0)) {
                          ^
87.               d2i = (D2I_OF(void)) d2i_X509_AUX;
88.               if (xi->x509 != NULL) {

crypto/pem/pem_info.c:96:20: Taking false branch
94.               }
95.               pp = &(xi->x509);
96.           } else if (strcmp(name, PEM_STRING_X509_CRL) == 0) {
                         ^
97.               d2i = (D2I_OF(void)) d2i_X509_CRL;
98.               if (xi->crl != NULL) {

crypto/pem/pem_info.c:108:13: Taking false branch
106.           } else
107.   #ifndef OPENSSL_NO_RSA
108.           if (strcmp(name, PEM_STRING_RSA) == 0) {
                   ^
109.               d2i = (D2I_OF(void)) d2i_RSAPrivateKey;
110.               if (xi->x_pkey != NULL) {

crypto/pem/pem_info.c:131:13: Taking true branch
129.   #endif
130.   #ifndef OPENSSL_NO_DSA
131.           if (strcmp(name, PEM_STRING_DSA) == 0) {
                   ^
132.               d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
133.               if (xi->x_pkey != NULL) {

crypto/pem/pem_info.c:132:13: 
130.   #ifndef OPENSSL_NO_DSA
131.           if (strcmp(name, PEM_STRING_DSA) == 0) {
132. >             d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
133.               if (xi->x_pkey != NULL) {
134.                   if (!sk_X509_INFO_push(ret, xi))

crypto/pem/pem_info.c:133:17: Taking true branch
131.           if (strcmp(name, PEM_STRING_DSA) == 0) {
132.               d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
133.               if (xi->x_pkey != NULL) {
                       ^
134.                   if (!sk_X509_INFO_push(ret, xi))
135.                       goto err;

crypto/pem/pem_info.c:134:22: 
132.               d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
133.               if (xi->x_pkey != NULL) {
134. >                 if (!sk_X509_INFO_push(ret, xi))
135.                       goto err;
136.                   if ((xi = X509_INFO_new()) == NULL)

include/openssl/x509.h:252:1: start of procedure sk_X509_INFO_push()
  250.   } X509_INFO;
  251.   
  252. > DEFINE_STACK_OF(X509_INFO)
  253.   
  254.   /*

crypto/stack/stack.c:219:1: start of procedure OPENSSL_sk_push()
    217.   }
    218.   
    219. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));

crypto/stack/stack.c:221:5: Skipping OPENSSL_sk_insert(): empty list of specs
    219.   int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));
               ^
    222.   }
    223.   

crypto/stack/stack.c:222:1: return from a call to OPENSSL_sk_push
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));
    222. > }
    223.   
    224.   int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data)

include/openssl/x509.h:252:1: return from a call to sk_X509_INFO_push
  250.   } X509_INFO;
  251.   
  252. > DEFINE_STACK_OF(X509_INFO)
  253.   
  254.   /*

crypto/pem/pem_info.c:134:22: Taking false branch
132.               d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
133.               if (xi->x_pkey != NULL) {
134.                   if (!sk_X509_INFO_push(ret, xi))
                            ^
135.                       goto err;
136.                   if ((xi = X509_INFO_new()) == NULL)

crypto/pem/pem_info.c:136:21: 
134.                   if (!sk_X509_INFO_push(ret, xi))
135.                       goto err;
136. >                 if ((xi = X509_INFO_new()) == NULL)
137.                       goto err;
138.                   goto start;

crypto/asn1/x_info.c:16:1: start of procedure X509_INFO_new()
  14.   #include <openssl/x509.h>
  15.   
  16. > X509_INFO *X509_INFO_new(void)
  17.   {
  18.       X509_INFO *ret;

crypto/asn1/x_info.c:20:5: 
  18.       X509_INFO *ret;
  19.   
  20. >     ret = OPENSSL_zalloc(sizeof(*ret));
  21.       if (ret == NULL) {
  22.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:5: 
    186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188. >     void *ret = CRYPTO_malloc(num, file, line);
    189.   
    190.       FAILTEST();

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
      156.   #endif
      157.   
      158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160.       void *ret = NULL;

crypto/mem.c:160:5: 
      158.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160. >     void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:162:9: Taking false branch
      160.       void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      163.           return malloc_impl(num, file, line);
      164.   

crypto/mem.c:165:9: Taking false branch
      163.           return malloc_impl(num, file, line);
      164.   
      165.       if (num == 0)
                     ^
      166.           return NULL;
      167.   

crypto/mem.c:169:5: 
      167.   
      168.       FAILTEST();
      169. >     allow_customize = 0;
      170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:179:24: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:180:5: 
      178.   #else
      179.       osslargused(file); osslargused(line);
      180. >     ret = malloc(num);
      181.   #endif
      182.   

crypto/mem.c:183:5: 
      181.   #endif
      182.   
      183. >     return ret;
      184.   }
      185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
      182.   
      183.       return ret;
      184. > }
      185.   
      186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:191:9: Taking true branch
    189.   
    190.       FAILTEST();
    191.       if (ret != NULL)
                   ^
    192.           memset(ret, 0, num);
    193.       return ret;

crypto/mem.c:192:9: 
    190.       FAILTEST();
    191.       if (ret != NULL)
    192. >         memset(ret, 0, num);
    193.       return ret;
    194.   }

crypto/mem.c:193:5: 
    191.       if (ret != NULL)
    192.           memset(ret, 0, num);
    193. >     return ret;
    194.   }
    195.   

crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
    192.           memset(ret, 0, num);
    193.       return ret;
    194. > }
    195.   
    196.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/x_info.c:21:9: Taking false branch
  19.   
  20.       ret = OPENSSL_zalloc(sizeof(*ret));
  21.       if (ret == NULL) {
                ^
  22.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);
  23.           return NULL;

crypto/asn1/x_info.c:26:5: 
  24.       }
  25.   
  26. >     return ret;
  27.   }
  28.   

crypto/asn1/x_info.c:27:1: return from a call to X509_INFO_new
  25.   
  26.       return ret;
  27. > }
  28.   
  29.   void X509_INFO_free(X509_INFO *x)

STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,
                                            pem_password_cb *cb, void *u)
{
    X509_INFO *xi = NULL;
    char *name = NULL, *header = NULL;
    void *pp;
    unsigned char *data = NULL;
    const unsigned char *p;
    long len, error = 0;
    int ok = 0;
    STACK_OF(X509_INFO) *ret = NULL;
    unsigned int i, raw, ptype;
    d2i_of_void *d2i = 0;
    if (sk == NULL) {
        if ((ret = sk_X509_INFO_new_null()) == NULL) {
            PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_MALLOC_FAILURE);
            goto err;
        }
    } else
        ret = sk;
    if ((xi = X509_INFO_new()) == NULL)
        goto err;
    for (;;) {
        raw = 0;
        ptype = 0;
        i = PEM_read_bio(bp, &name, &header, &data, &len);
        if (i == 0) {
            error = ERR_GET_REASON(ERR_peek_last_error());
            if (error == PEM_R_NO_START_LINE) {
                ERR_clear_error();
                break;
            }
            goto err;
        }
 start:
        if ((strcmp(name, PEM_STRING_X509) == 0) ||
            (strcmp(name, PEM_STRING_X509_OLD) == 0)) {
            d2i = (D2I_OF(void)) d2i_X509;
            if (xi->x509 != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            pp = &(xi->x509);
        } else if ((strcmp(name, PEM_STRING_X509_TRUSTED) == 0)) {
            d2i = (D2I_OF(void)) d2i_X509_AUX;
            if (xi->x509 != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            pp = &(xi->x509);
        } else if (strcmp(name, PEM_STRING_X509_CRL) == 0) {
            d2i = (D2I_OF(void)) d2i_X509_CRL;
            if (xi->crl != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            pp = &(xi->crl);
        } else
#ifndef OPENSSL_NO_RSA
        if (strcmp(name, PEM_STRING_RSA) == 0) {
            d2i = (D2I_OF(void)) d2i_RSAPrivateKey;
            if (xi->x_pkey != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            xi->enc_data = NULL;
            xi->enc_len = 0;
            xi->x_pkey = X509_PKEY_new();
            if (xi->x_pkey == NULL)
                goto err;
            ptype = EVP_PKEY_RSA;
            pp = &xi->x_pkey->dec_pkey;
            if ((int)strlen(header) > 10)
                raw = 1;
        } else
#endif
#ifndef OPENSSL_NO_DSA
        if (strcmp(name, PEM_STRING_DSA) == 0) {
            d2i = (D2I_OF(void)) d2i_DSAPrivateKey;
            if (xi->x_pkey != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            xi->enc_data = NULL;
            xi->enc_len = 0;
            xi->x_pkey = X509_PKEY_new();
            if (xi->x_pkey == NULL)
                goto err;
            ptype = EVP_PKEY_DSA;
            pp = &xi->x_pkey->dec_pkey;
            if ((int)strlen(header) > 10)
                raw = 1;
        } else
#endif
#ifndef OPENSSL_NO_EC
        if (strcmp(name, PEM_STRING_ECPRIVATEKEY) == 0) {
            d2i = (D2I_OF(void)) d2i_ECPrivateKey;
            if (xi->x_pkey != NULL) {
                if (!sk_X509_INFO_push(ret, xi))
                    goto err;
                if ((xi = X509_INFO_new()) == NULL)
                    goto err;
                goto start;
            }
            xi->enc_data = NULL;
            xi->enc_len = 0;
            xi->x_pkey = X509_PKEY_new();
            if (xi->x_pkey == NULL)
                goto err;
            ptype = EVP_PKEY_EC;
            pp = &xi->x_pkey->dec_pkey;
            if ((int)strlen(header) > 10)
                raw = 1;
        } else
#endif
        {
            d2i = NULL;
            pp = NULL;
        }
        if (d2i != NULL) {
            if (!raw) {
                EVP_CIPHER_INFO cipher;
                if (!PEM_get_EVP_CIPHER_INFO(header, &cipher))
                    goto err;
                if (!PEM_do_header(&cipher, data, &len, cb, u))
                    goto err;
                p = data;
                if (ptype) {
                    if (!d2i_PrivateKey(ptype, pp, &p, len)) {
                        PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_ASN1_LIB);
                        goto err;
                    }
                } else if (d2i(pp, &p, len) == NULL) {
                    PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_ASN1_LIB);
                    goto err;
                }
            } else {
                if (!PEM_get_EVP_CIPHER_INFO(header, &xi->enc_cipher))
                    goto err;
                xi->enc_data = (char *)data;
                xi->enc_len = (int)len;
                data = NULL;
            }
        } else {
        }
        OPENSSL_free(name);
        name = NULL;
        OPENSSL_free(header);
        header = NULL;
        OPENSSL_free(data);
        data = NULL;
    }
    if ((xi->x509 != NULL) || (xi->crl != NULL) ||
        (xi->x_pkey != NULL) || (xi->enc_data != NULL)) {
        if (!sk_X509_INFO_push(ret, xi))
            goto err;
        xi = NULL;
    }
    ok = 1;
 err:
    X509_INFO_free(xi);
    if (!ok) {
        for (i = 0; ((int)i) < sk_X509_INFO_num(ret); i++) {
            xi = sk_X509_INFO_value(ret, i);
            X509_INFO_free(xi);
        }
        if (ret != sk)
            sk_X509_INFO_free(ret);
        ret = NULL;
    }
    OPENSSL_free(name);
    OPENSSL_free(header);
    OPENSSL_free(data);
    return (ret);
}
['STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,\n                                            pem_password_cb *cb, void *u)\n{\n    X509_INFO *xi = NULL;\n    char *name = NULL, *header = NULL;\n    void *pp;\n    unsigned char *data = NULL;\n    const unsigned char *p;\n    long len, error = 0;\n    int ok = 0;\n    STACK_OF(X509_INFO) *ret = NULL;\n    unsigned int i, raw, ptype;\n    d2i_of_void *d2i = 0;\n    if (sk == NULL) {\n        if ((ret = sk_X509_INFO_new_null()) == NULL) {\n            PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n    } else\n        ret = sk;\n    if ((xi = X509_INFO_new()) == NULL)\n        goto err;\n    for (;;) {\n        raw = 0;\n        ptype = 0;\n        i = PEM_read_bio(bp, &name, &header, &data, &len);\n        if (i == 0) {\n            error = ERR_GET_REASON(ERR_peek_last_error());\n            if (error == PEM_R_NO_START_LINE) {\n                ERR_clear_error();\n                break;\n            }\n            goto err;\n        }\n start:\n        if ((strcmp(name, PEM_STRING_X509) == 0) ||\n            (strcmp(name, PEM_STRING_X509_OLD) == 0)) {\n            d2i = (D2I_OF(void)) d2i_X509;\n            if (xi->x509 != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            pp = &(xi->x509);\n        } else if ((strcmp(name, PEM_STRING_X509_TRUSTED) == 0)) {\n            d2i = (D2I_OF(void)) d2i_X509_AUX;\n            if (xi->x509 != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            pp = &(xi->x509);\n        } else if (strcmp(name, PEM_STRING_X509_CRL) == 0) {\n            d2i = (D2I_OF(void)) d2i_X509_CRL;\n            if (xi->crl != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            pp = &(xi->crl);\n        } else\n#ifndef OPENSSL_NO_RSA\n        if (strcmp(name, PEM_STRING_RSA) == 0) {\n            d2i = (D2I_OF(void)) d2i_RSAPrivateKey;\n            if (xi->x_pkey != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            xi->enc_data = NULL;\n            xi->enc_len = 0;\n            xi->x_pkey = X509_PKEY_new();\n            if (xi->x_pkey == NULL)\n                goto err;\n            ptype = EVP_PKEY_RSA;\n            pp = &xi->x_pkey->dec_pkey;\n            if ((int)strlen(header) > 10)\n                raw = 1;\n        } else\n#endif\n#ifndef OPENSSL_NO_DSA\n        if (strcmp(name, PEM_STRING_DSA) == 0) {\n            d2i = (D2I_OF(void)) d2i_DSAPrivateKey;\n            if (xi->x_pkey != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            xi->enc_data = NULL;\n            xi->enc_len = 0;\n            xi->x_pkey = X509_PKEY_new();\n            if (xi->x_pkey == NULL)\n                goto err;\n            ptype = EVP_PKEY_DSA;\n            pp = &xi->x_pkey->dec_pkey;\n            if ((int)strlen(header) > 10)\n                raw = 1;\n        } else\n#endif\n#ifndef OPENSSL_NO_EC\n        if (strcmp(name, PEM_STRING_ECPRIVATEKEY) == 0) {\n            d2i = (D2I_OF(void)) d2i_ECPrivateKey;\n            if (xi->x_pkey != NULL) {\n                if (!sk_X509_INFO_push(ret, xi))\n                    goto err;\n                if ((xi = X509_INFO_new()) == NULL)\n                    goto err;\n                goto start;\n            }\n            xi->enc_data = NULL;\n            xi->enc_len = 0;\n            xi->x_pkey = X509_PKEY_new();\n            if (xi->x_pkey == NULL)\n                goto err;\n            ptype = EVP_PKEY_EC;\n            pp = &xi->x_pkey->dec_pkey;\n            if ((int)strlen(header) > 10)\n                raw = 1;\n        } else\n#endif\n        {\n            d2i = NULL;\n            pp = NULL;\n        }\n        if (d2i != NULL) {\n            if (!raw) {\n                EVP_CIPHER_INFO cipher;\n                if (!PEM_get_EVP_CIPHER_INFO(header, &cipher))\n                    goto err;\n                if (!PEM_do_header(&cipher, data, &len, cb, u))\n                    goto err;\n                p = data;\n                if (ptype) {\n                    if (!d2i_PrivateKey(ptype, pp, &p, len)) {\n                        PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_ASN1_LIB);\n                        goto err;\n                    }\n                } else if (d2i(pp, &p, len) == NULL) {\n                    PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_ASN1_LIB);\n                    goto err;\n                }\n            } else {\n                if (!PEM_get_EVP_CIPHER_INFO(header, &xi->enc_cipher))\n                    goto err;\n                xi->enc_data = (char *)data;\n                xi->enc_len = (int)len;\n                data = NULL;\n            }\n        } else {\n        }\n        OPENSSL_free(name);\n        name = NULL;\n        OPENSSL_free(header);\n        header = NULL;\n        OPENSSL_free(data);\n        data = NULL;\n    }\n    if ((xi->x509 != NULL) || (xi->crl != NULL) ||\n        (xi->x_pkey != NULL) || (xi->enc_data != NULL)) {\n        if (!sk_X509_INFO_push(ret, xi))\n            goto err;\n        xi = NULL;\n    }\n    ok = 1;\n err:\n    X509_INFO_free(xi);\n    if (!ok) {\n        for (i = 0; ((int)i) < sk_X509_INFO_num(ret); i++) {\n            xi = sk_X509_INFO_value(ret, i);\n            X509_INFO_free(xi);\n        }\n        if (ret != sk)\n            sk_X509_INFO_free(ret);\n        ret = NULL;\n    }\n    OPENSSL_free(name);\n    OPENSSL_free(header);\n    OPENSSL_free(data);\n    return (ret);\n}', 'DEFINE_STACK_OF(X509_INFO)', 'OPENSSL_STACK *OPENSSL_sk_new_null(void)\n{\n    return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);\n}', 'X509_INFO *X509_INFO_new(void)\n{\n    X509_INFO *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    return ret;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)\n{\n    return (OPENSSL_sk_insert(st, data, st->num));\n}']