crypto/ts/ts_rsp_sign.c:877: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_STRING_new()` at line 871, column 16 is not reachable after line 877, column 5.
Showing all 130 steps of the trace


crypto/ts/ts_rsp_sign.c:858:1: start of procedure ESS_add_signing_cert()
856.   }
857.   
858. > static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
859.   {
860.       ASN1_STRING *seq = NULL;

crypto/ts/ts_rsp_sign.c:860:5: 
858.   static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
859.   {
860. >     ASN1_STRING *seq = NULL;
861.       unsigned char *p, *pp = NULL;
862.       int len;

crypto/ts/ts_rsp_sign.c:861:5: 
859.   {
860.       ASN1_STRING *seq = NULL;
861. >     unsigned char *p, *pp = NULL;
862.       int len;
863.   

crypto/ts/ts_rsp_sign.c:864:5: 
862.       int len;
863.   
864. >     len = i2d_ESS_SIGNING_CERT(sc, NULL);
865.       if ((pp = OPENSSL_malloc(len)) == NULL) {
866.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);

crypto/ts/ts_asn1.c:274:1: start of procedure i2d_ESS_SIGNING_CERT()
  272.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  273.   
  274. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  275.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  276.   

crypto/asn1/tasn_enc.c:92:1: start of procedure ASN1_item_i2d()
    90.   }
    91.   
    92. > int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    93.   {
    94.       return asn1_item_flags_i2d(val, out, it, 0);

crypto/asn1/tasn_enc.c:94:5: 
    92.   int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    93.   {
    94. >     return asn1_item_flags_i2d(val, out, it, 0);
    95.   }
    96.   

crypto/asn1/tasn_enc.c:104:1: start of procedure asn1_item_flags_i2d()
      102.    */
      103.   
      104. > static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
      105.                                  const ASN1_ITEM *it, int flags)
      106.   {

crypto/asn1/tasn_enc.c:107:9: Taking false branch
      105.                                  const ASN1_ITEM *it, int flags)
      106.   {
      107.       if (out && !*out) {
                     ^
      108.           unsigned char *p, *buf;
      109.           int len;

crypto/asn1/tasn_enc.c:122:5: Skipping ASN1_item_ex_i2d(): empty list of specs
      120.       }
      121.   
      122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
                 ^
      123.   }
      124.   

crypto/asn1/tasn_enc.c:123:1: return from a call to asn1_item_flags_i2d
      121.   
      122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
      123. > }
      124.   
      125.   /*

crypto/asn1/tasn_enc.c:95:1: return from a call to ASN1_item_i2d
    93.   {
    94.       return asn1_item_flags_i2d(val, out, it, 0);
    95. > }
    96.   
    97.   /*

crypto/ts/ts_asn1.c:274:1: return from a call to i2d_ESS_SIGNING_CERT
  272.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  273.   
  274. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  275.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  276.   

crypto/ts/ts_rsp_sign.c:865:9: 
863.   
864.       len = i2d_ESS_SIGNING_CERT(sc, NULL);
865. >     if ((pp = OPENSSL_malloc(len)) == NULL) {
866.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
867.           goto err;

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
  118.   }
  119.   
  120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  121.   {
  122.       void *ret = NULL;

crypto/mem.c:122:5: 
  120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  121.   {
  122. >     void *ret = NULL;
  123.   
  124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
  122.       void *ret = NULL;
  123.   
  124.       if (num <= 0)
                 ^
  125.           return NULL;
  126.   

crypto/mem.c:127:5: 
  125.           return NULL;
  126.   
  127. >     allow_customize = 0;
  128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
  135.       }
  136.   #else
  137. >     (void)file;
  138.       (void)line;
  139.       ret = malloc(num);

crypto/mem.c:138:5: 
  136.   #else
  137.       (void)file;
  138. >     (void)line;
  139.       ret = malloc(num);
  140.   #endif

crypto/mem.c:139:5: 
  137.       (void)file;
  138.       (void)line;
  139. >     ret = malloc(num);
  140.   #endif
  141.   

crypto/mem.c:154:5: 
  152.   #endif
  153.   
  154. >     return ret;
  155.   }
  156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
  153.   
  154.       return ret;
  155. > }
  156.   
  157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/ts/ts_rsp_sign.c:865:9: Taking false branch
863.   
864.       len = i2d_ESS_SIGNING_CERT(sc, NULL);
865.       if ((pp = OPENSSL_malloc(len)) == NULL) {
               ^
866.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
867.           goto err;

crypto/ts/ts_rsp_sign.c:869:5: 
867.           goto err;
868.       }
869. >     p = pp;
870.       i2d_ESS_SIGNING_CERT(sc, &p);
871.       if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {

crypto/ts/ts_rsp_sign.c:870:5: 
868.       }
869.       p = pp;
870. >     i2d_ESS_SIGNING_CERT(sc, &p);
871.       if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
872.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);

crypto/ts/ts_asn1.c:274:1: start of procedure i2d_ESS_SIGNING_CERT()
  272.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  273.   
  274. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  275.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  276.   

crypto/asn1/tasn_enc.c:92:1: start of procedure ASN1_item_i2d()
    90.   }
    91.   
    92. > int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    93.   {
    94.       return asn1_item_flags_i2d(val, out, it, 0);

crypto/asn1/tasn_enc.c:94:5: 
    92.   int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
    93.   {
    94. >     return asn1_item_flags_i2d(val, out, it, 0);
    95.   }
    96.   

crypto/asn1/tasn_enc.c:104:1: start of procedure asn1_item_flags_i2d()
      102.    */
      103.   
      104. > static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
      105.                                  const ASN1_ITEM *it, int flags)
      106.   {

crypto/asn1/tasn_enc.c:107:9: Taking true branch
      105.                                  const ASN1_ITEM *it, int flags)
      106.   {
      107.       if (out && !*out) {
                     ^
      108.           unsigned char *p, *buf;
      109.           int len;

crypto/asn1/tasn_enc.c:107:17: Taking false branch
      105.                                  const ASN1_ITEM *it, int flags)
      106.   {
      107.       if (out && !*out) {
                             ^
      108.           unsigned char *p, *buf;
      109.           int len;

crypto/asn1/tasn_enc.c:122:5: Skipping ASN1_item_ex_i2d(): empty list of specs
      120.       }
      121.   
      122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
                 ^
      123.   }
      124.   

crypto/asn1/tasn_enc.c:123:1: return from a call to asn1_item_flags_i2d
      121.   
      122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
      123. > }
      124.   
      125.   /*

crypto/asn1/tasn_enc.c:95:1: return from a call to ASN1_item_i2d
    93.   {
    94.       return asn1_item_flags_i2d(val, out, it, 0);
    95. > }
    96.   
    97.   /*

crypto/ts/ts_asn1.c:274:1: return from a call to i2d_ESS_SIGNING_CERT
  272.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  273.   
  274. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  275.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  276.   

crypto/ts/ts_rsp_sign.c:871:9: 
869.       p = pp;
870.       i2d_ESS_SIGNING_CERT(sc, &p);
871. >     if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
872.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
873.           goto err;

crypto/asn1/asn1_lib.c:344:1: start of procedure ASN1_STRING_new()
  342.   }
  343.   
  344. > ASN1_STRING *ASN1_STRING_new(void)
  345.   {
  346.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));

crypto/asn1/asn1_lib.c:346:5: 
  344.   ASN1_STRING *ASN1_STRING_new(void)
  345.   {
  346. >     return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
  347.   }
  348.   

crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new()
    347.   }
    348.   
    349. > ASN1_STRING *ASN1_STRING_type_new(int type)
    350.   {
    351.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:353:5: 
    351.       ASN1_STRING *ret;
    352.   
    353. >     ret = OPENSSL_zalloc(sizeof(*ret));
    354.       if (ret == NULL) {
    355.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

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

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

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
        118.   }
        119.   
        120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        121.   {
        122.       void *ret = NULL;

crypto/mem.c:122:5: 
        120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        121.   {
        122. >     void *ret = NULL;
        123.   
        124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

crypto/mem.c:127:5: 
        125.           return NULL;
        126.   
        127. >     allow_customize = 0;
        128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
        135.       }
        136.   #else
        137. >     (void)file;
        138.       (void)line;
        139.       ret = malloc(num);

crypto/mem.c:138:5: 
        136.   #else
        137.       (void)file;
        138. >     (void)line;
        139.       ret = malloc(num);
        140.   #endif

crypto/mem.c:139:5: 
        137.       (void)file;
        138.       (void)line;
        139. >     ret = malloc(num);
        140.   #endif
        141.   

crypto/mem.c:154:5: 
        152.   #endif
        153.   
        154. >     return ret;
        155.   }
        156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
        153.   
        154.       return ret;
        155. > }
        156.   
        157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
      159.       void *ret = CRYPTO_malloc(num, file, line);
      160.   
      161.       if (ret != NULL)
                     ^
      162.           memset(ret, 0, num);
      163.       return ret;

crypto/mem.c:162:9: 
      160.   
      161.       if (ret != NULL)
      162. >         memset(ret, 0, num);
      163.       return ret;
      164.   }

crypto/mem.c:163:5: 
      161.       if (ret != NULL)
      162.           memset(ret, 0, num);
      163. >     return ret;
      164.   }
      165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
      162.           memset(ret, 0, num);
      163.       return ret;
      164. > }
      165.   
      166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/asn1_lib.c:354:9: Taking false branch
    352.   
    353.       ret = OPENSSL_zalloc(sizeof(*ret));
    354.       if (ret == NULL) {
                   ^
    355.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    356.           return (NULL);

crypto/asn1/asn1_lib.c:358:5: 
    356.           return (NULL);
    357.       }
    358. >     ret->type = type;
    359.       return (ret);
    360.   }

crypto/asn1/asn1_lib.c:359:5: 
    357.       }
    358.       ret->type = type;
    359. >     return (ret);
    360.   }
    361.   

crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new
    358.       ret->type = type;
    359.       return (ret);
    360. > }
    361.   
    362.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/asn1_lib.c:347:1: return from a call to ASN1_STRING_new
  345.   {
  346.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
  347. > }
  348.   
  349.   ASN1_STRING *ASN1_STRING_type_new(int type)

crypto/ts/ts_rsp_sign.c:871:9: Taking false branch
869.       p = pp;
870.       i2d_ESS_SIGNING_CERT(sc, &p);
871.       if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
               ^
872.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
873.           goto err;

crypto/ts/ts_rsp_sign.c:871:47: 
869.       p = pp;
870.       i2d_ESS_SIGNING_CERT(sc, &p);
871. >     if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
872.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
873.           goto err;

crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set()
  306.   }
  307.   
  308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
  309.   {
  310.       unsigned char *c;

crypto/asn1/asn1_lib.c:311:5: 
  309.   {
  310.       unsigned char *c;
  311. >     const char *data = _data;
  312.   
  313.       if (len < 0) {

crypto/asn1/asn1_lib.c:313:9: Taking false branch
  311.       const char *data = _data;
  312.   
  313.       if (len < 0) {
                 ^
  314.           if (data == NULL)
  315.               return (0);

crypto/asn1/asn1_lib.c:319:10: Taking true branch
  317.               len = strlen(data);
  318.       }
  319.       if ((str->length < len) || (str->data == NULL)) {
                  ^
  320.           c = str->data;
  321.           str->data = OPENSSL_realloc(c, len + 1);

crypto/asn1/asn1_lib.c:320:9: 
  318.       }
  319.       if ((str->length < len) || (str->data == NULL)) {
  320. >         c = str->data;
  321.           str->data = OPENSSL_realloc(c, len + 1);
  322.           if (str->data == NULL) {

crypto/asn1/asn1_lib.c:321:9: 
  319.       if ((str->length < len) || (str->data == NULL)) {
  320.           c = str->data;
  321. >         str->data = OPENSSL_realloc(c, len + 1);
  322.           if (str->data == NULL) {
  323.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);

crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
    164.   }
    165.   
    166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
    167.   {
    168.       if (str == NULL)

crypto/mem.c:168:9: Taking false branch
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
    167.   {
    168.       if (str == NULL)
                   ^
    169.           return CRYPTO_malloc(num, file, line);
    170.   

crypto/mem.c:171:9: Taking false branch
    169.           return CRYPTO_malloc(num, file, line);
    170.   
    171.       if (num == 0) {
                   ^
    172.           CRYPTO_free(str);
    173.           return NULL;

crypto/mem.c:176:5: 
    174.       }
    175.   
    176. >     allow_customize = 0;
    177.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    178.       if (call_malloc_debug) {

crypto/mem.c:186:5: 
    184.       }
    185.   #else
    186. >     (void)file;
    187.       (void)line;
    188.   #endif

crypto/mem.c:187:5: 
    185.   #else
    186.       (void)file;
    187. >     (void)line;
    188.   #endif
    189.       return realloc(str, num);

crypto/mem.c:189:5: 
    187.       (void)line;
    188.   #endif
    189. >     return realloc(str, num);
    190.   
    191.   }

crypto/mem.c:191:1: return from a call to CRYPTO_realloc
    189.       return realloc(str, num);
    190.   
    191. > }
    192.   
    193.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/asn1/asn1_lib.c:322:13: Taking false branch
  320.           c = str->data;
  321.           str->data = OPENSSL_realloc(c, len + 1);
  322.           if (str->data == NULL) {
                     ^
  323.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
  324.               str->data = c;

crypto/asn1/asn1_lib.c:328:5: 
  326.           }
  327.       }
  328. >     str->length = len;
  329.       if (data != NULL) {
  330.           memcpy(str->data, data, len);

crypto/asn1/asn1_lib.c:329:9: Taking true branch
  327.       }
  328.       str->length = len;
  329.       if (data != NULL) {
                 ^
  330.           memcpy(str->data, data, len);
  331.           /* an allowance for strings :-) */

crypto/asn1/asn1_lib.c:330:9: 
  328.       str->length = len;
  329.       if (data != NULL) {
  330. >         memcpy(str->data, data, len);
  331.           /* an allowance for strings :-) */
  332.           str->data[len] = '\0';

crypto/asn1/asn1_lib.c:332:9: 
  330.           memcpy(str->data, data, len);
  331.           /* an allowance for strings :-) */
  332. >         str->data[len] = '\0';
  333.       }
  334.       return (1);

crypto/asn1/asn1_lib.c:334:5: 
  332.           str->data[len] = '\0';
  333.       }
  334. >     return (1);
  335.   }
  336.   

crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set
  333.       }
  334.       return (1);
  335. > }
  336.   
  337.   void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)

crypto/ts/ts_rsp_sign.c:871:47: Taking false branch
869.       p = pp;
870.       i2d_ESS_SIGNING_CERT(sc, &p);
871.       if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
                                                     ^
872.           TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
873.           goto err;

crypto/ts/ts_rsp_sign.c:875:5: 
873.           goto err;
874.       }
875. >     OPENSSL_free(pp);
876.       pp = NULL;
877.       return PKCS7_add_signed_attribute(si,

crypto/mem.c:234:1: start of procedure CRYPTO_free()
  232.   }
  233.   
  234. > void CRYPTO_free(void *str)
  235.   {
  236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: 
  243.       }
  244.   #else
  245. >     free(str);
  246.   #endif
  247.   }

crypto/mem.c:247:1: return from a call to CRYPTO_free
  245.       free(str);
  246.   #endif
  247. > }
  248.   
  249.   void CRYPTO_clear_free(void *str, size_t num)

crypto/ts/ts_rsp_sign.c:876:5: 
874.       }
875.       OPENSSL_free(pp);
876. >     pp = NULL;
877.       return PKCS7_add_signed_attribute(si,
878.                                         NID_id_smime_aa_signingCertificate,

crypto/ts/ts_rsp_sign.c:877:5: 
875.       OPENSSL_free(pp);
876.       pp = NULL;
877. >     return PKCS7_add_signed_attribute(si,
878.                                         NID_id_smime_aa_signingCertificate,
879.                                         V_ASN1_SEQUENCE, seq);

crypto/pkcs7/pk7_doit.c:1177:1: start of procedure PKCS7_add_signed_attribute()
  1175.   }
  1176.   
  1177. > int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
  1178.                                  void *value)
  1179.   {

crypto/pkcs7/pk7_doit.c:1180:5: 
  1178.                                  void *value)
  1179.   {
  1180. >     return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));
  1181.   }
  1182.   

crypto/pkcs7/pk7_doit.c:1189:1: start of procedure add_attribute()
    1187.   }
    1188.   
    1189. > static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
    1190.                            void *value)
    1191.   {

crypto/pkcs7/pk7_doit.c:1192:5: 
    1190.                            void *value)
    1191.   {
    1192. >     X509_ATTRIBUTE *attr = NULL;
    1193.   
    1194.       if (*sk == NULL) {

crypto/pkcs7/pk7_doit.c:1194:9: Taking true branch
    1192.       X509_ATTRIBUTE *attr = NULL;
    1193.   
    1194.       if (*sk == NULL) {
                    ^
    1195.           if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL)
    1196.               return 0;

crypto/pkcs7/pk7_doit.c:1195:13: 
    1193.   
    1194.       if (*sk == NULL) {
    1195. >         if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL)
    1196.               return 0;
    1197.    new_attrib:

include/openssl/x509.h:160:1: start of procedure sk_X509_ATTRIBUTE_new_null()
      158.   typedef struct x509_attributes_st X509_ATTRIBUTE;
      159.   
      160. > DEFINE_STACK_OF(X509_ATTRIBUTE)
      161.   
      162.   typedef struct X509_req_info_st X509_REQ_INFO;

crypto/stack/stack.c:145:1: start of procedure sk_new_null()
        143.   }
        144.   
        145. > _STACK *sk_new_null(void)
        146.   {
        147.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:147:5: 
        145.   _STACK *sk_new_null(void)
        146.   {
        147. >     return sk_new((int (*)(const void *, const void *))0);
        148.   }
        149.   

crypto/stack/stack.c:150:1: start of procedure sk_new()
          148.   }
          149.   
          150. > _STACK *sk_new(int (*c) (const void *, const void *))
          151.   {
          152.       _STACK *ret;

crypto/stack/stack.c:154:9: 
          152.       _STACK *ret;
          153.   
          154. >     if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
          155.           goto err;
          156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

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

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

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
              118.   }
              119.   
              120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
              121.   {
              122.       void *ret = NULL;

crypto/mem.c:122:5: 
              120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
              121.   {
              122. >     void *ret = NULL;
              123.   
              124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
              122.       void *ret = NULL;
              123.   
              124.       if (num <= 0)
                             ^
              125.           return NULL;
              126.   

crypto/mem.c:127:5: 
              125.           return NULL;
              126.   
              127. >     allow_customize = 0;
              128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
              129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
              135.       }
              136.   #else
              137. >     (void)file;
              138.       (void)line;
              139.       ret = malloc(num);

crypto/mem.c:138:5: 
              136.   #else
              137.       (void)file;
              138. >     (void)line;
              139.       ret = malloc(num);
              140.   #endif

crypto/mem.c:139:5: 
              137.       (void)file;
              138.       (void)line;
              139. >     ret = malloc(num);
              140.   #endif
              141.   

crypto/mem.c:154:5: 
              152.   #endif
              153.   
              154. >     return ret;
              155.   }
              156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
              153.   
              154.       return ret;
              155. > }
              156.   
              157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

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

crypto/mem.c:163:5: 
            161.       if (ret != NULL)
            162.           memset(ret, 0, num);
            163. >     return ret;
            164.   }
            165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
            162.           memset(ret, 0, num);
            163.       return ret;
            164. > }
            165.   
            166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/stack/stack.c:154:9: Taking true branch
          152.       _STACK *ret;
          153.   
          154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
                         ^
          155.           goto err;
          156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

crypto/stack/stack.c:162:2: 
          160.       return (ret);
          161.   
          162. >  err:
          163.       OPENSSL_free(ret);
          164.       return (NULL);

crypto/stack/stack.c:163:5: 
          161.   
          162.    err:
          163. >     OPENSSL_free(ret);
          164.       return (NULL);
          165.   }

crypto/mem.c:234:1: start of procedure CRYPTO_free()
            232.   }
            233.   
            234. > void CRYPTO_free(void *str)
            235.   {
            236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: 
            243.       }
            244.   #else
            245. >     free(str);
            246.   #endif
            247.   }

crypto/mem.c:247:1: return from a call to CRYPTO_free
            245.       free(str);
            246.   #endif
            247. > }
            248.   
            249.   void CRYPTO_clear_free(void *str, size_t num)

crypto/stack/stack.c:164:5: 
          162.    err:
          163.       OPENSSL_free(ret);
          164. >     return (NULL);
          165.   }
          166.   

crypto/stack/stack.c:165:1: return from a call to sk_new
          163.       OPENSSL_free(ret);
          164.       return (NULL);
          165. > }
          166.   
          167.   int sk_insert(_STACK *st, void *data, int loc)

crypto/stack/stack.c:148:1: return from a call to sk_new_null
        146.   {
        147.       return sk_new((int (*)(const void *, const void *))0);
        148. > }
        149.   
        150.   _STACK *sk_new(int (*c) (const void *, const void *))

include/openssl/x509.h:160:1: return from a call to sk_X509_ATTRIBUTE_new_null
      158.   typedef struct x509_attributes_st X509_ATTRIBUTE;
      159.   
      160. > DEFINE_STACK_OF(X509_ATTRIBUTE)
      161.   
      162.   typedef struct X509_req_info_st X509_REQ_INFO;

crypto/pkcs7/pk7_doit.c:1195:13: Taking true branch
    1193.   
    1194.       if (*sk == NULL) {
    1195.           if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL)
                        ^
    1196.               return 0;
    1197.    new_attrib:

crypto/pkcs7/pk7_doit.c:1196:13: 
    1194.       if (*sk == NULL) {
    1195.           if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL)
    1196. >             return 0;
    1197.    new_attrib:
    1198.           if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL)

crypto/pkcs7/pk7_doit.c:1225:1: return from a call to add_attribute
    1223.    end:
    1224.       return (1);
    1225. > }

crypto/pkcs7/pk7_doit.c:1181:1: return from a call to PKCS7_add_signed_attribute
  1179.   {
  1180.       return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));
  1181. > }
  1182.   
  1183.   int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,

static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
{
    ASN1_STRING *seq = NULL;
    unsigned char *p, *pp = NULL;
    int len;
    len = i2d_ESS_SIGNING_CERT(sc, NULL);
    if ((pp = OPENSSL_malloc(len)) == NULL) {
        TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    p = pp;
    i2d_ESS_SIGNING_CERT(sc, &p);
    if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {
        TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    OPENSSL_free(pp);
    pp = NULL;
    return PKCS7_add_signed_attribute(si,
                                      NID_id_smime_aa_signingCertificate,
                                      V_ASN1_SEQUENCE, seq);
 err:
    ASN1_STRING_free(seq);
    OPENSSL_free(pp);
    return 0;
}
['static int ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)\n{\n    ASN1_STRING *seq = NULL;\n    unsigned char *p, *pp = NULL;\n    int len;\n    len = i2d_ESS_SIGNING_CERT(sc, NULL);\n    if ((pp = OPENSSL_malloc(len)) == NULL) {\n        TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    p = pp;\n    i2d_ESS_SIGNING_CERT(sc, &p);\n    if ((seq = ASN1_STRING_new()) == NULL || !ASN1_STRING_set(seq, pp, len)) {\n        TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    OPENSSL_free(pp);\n    pp = NULL;\n    return PKCS7_add_signed_attribute(si,\n                                      NID_id_smime_aa_signingCertificate,\n                                      V_ASN1_SEQUENCE, seq);\n err:\n    ASN1_STRING_free(seq);\n    OPENSSL_free(pp);\n    return 0;\n}', 'IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)', 'int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)\n{\n    return asn1_item_flags_i2d(val, out, it, 0);\n}', 'static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,\n                               const ASN1_ITEM *it, int flags)\n{\n    if (out && !*out) {\n        unsigned char *p, *buf;\n        int len;\n        len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);\n        if (len <= 0)\n            return len;\n        buf = OPENSSL_malloc(len);\n        if (buf == NULL)\n            return -1;\n        p = buf;\n        ASN1_item_ex_i2d(&val, &p, it, -1, flags);\n        *out = buf;\n        return len;\n    }\n    return ASN1_item_ex_i2d(&val, out, it, -1, flags);\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\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    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'ASN1_STRING *ASN1_STRING_new(void)\n{\n    return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));\n}', 'ASN1_STRING *ASN1_STRING_type_new(int type)\n{\n    ASN1_STRING *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->type = type;\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    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', "int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)\n{\n    unsigned char *c;\n    const char *data = _data;\n    if (len < 0) {\n        if (data == NULL)\n            return (0);\n        else\n            len = strlen(data);\n    }\n    if ((str->length < len) || (str->data == NULL)) {\n        c = str->data;\n        str->data = OPENSSL_realloc(c, len + 1);\n        if (str->data == NULL) {\n            ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);\n            str->data = c;\n            return (0);\n        }\n    }\n    str->length = len;\n    if (data != NULL) {\n        memcpy(str->data, data, len);\n        str->data[len] = '\\0';\n    }\n    return (1);\n}", 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}', 'void CRYPTO_free(void *str)\n{\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}', 'int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,\n                               void *value)\n{\n    return (add_attribute(&(p7si->auth_attr), nid, atrtype, value));\n}', 'static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,\n                         void *value)\n{\n    X509_ATTRIBUTE *attr = NULL;\n    if (*sk == NULL) {\n        if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL)\n            return 0;\n new_attrib:\n        if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL)\n            return 0;\n        if (!sk_X509_ATTRIBUTE_push(*sk, attr)) {\n            X509_ATTRIBUTE_free(attr);\n            return 0;\n        }\n    } else {\n        int i;\n        for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) {\n            attr = sk_X509_ATTRIBUTE_value(*sk, i);\n            if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) {\n                X509_ATTRIBUTE_free(attr);\n                attr = X509_ATTRIBUTE_create(nid, atrtype, value);\n                if (attr == NULL)\n                    return 0;\n                if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) {\n                    X509_ATTRIBUTE_free(attr);\n                    return 0;\n                }\n                goto end;\n            }\n        }\n        goto new_attrib;\n    }\n end:\n    return (1);\n}', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', '_STACK *sk_new(int (*c) (const void *, const void *))\n{\n    _STACK *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)\n        goto err;\n    if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)\n        goto err;\n    ret->comp = c;\n    ret->num_alloc = MIN_NODES;\n    return (ret);\n err:\n    OPENSSL_free(ret);\n    return (NULL);\n}']