crypto/ts/ts_rsp_sign.c:881: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_STRING_new()` at line 871, column 16 is not reachable after line 881, column 5.
Showing all 92 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:273:1: start of procedure i2d_ESS_SIGNING_CERT()
  271.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  272.   
  273. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  274.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  275.   

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

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

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

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

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

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

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

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

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:119:1: start of procedure CRYPTO_malloc()
  117.   }
  118.   
  119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  120.   {
  121.       void *ret = NULL;

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

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

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

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

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

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

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

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
  152.   
  153.       return ret;
  154. > }
  155.   
  156.   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:273:1: start of procedure i2d_ESS_SIGNING_CERT()
  271.   } static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  272.   
  273. > IMPLEMENT_ASN1_FUNCTIONS_const(ESS_SIGNING_CERT)
  274.   IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  275.   

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

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

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

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

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

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

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

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

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

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:343:1: start of procedure ASN1_STRING_new()
  341.   }
  342.   
  343. > ASN1_STRING *ASN1_STRING_new(void)
  344.   {
  345.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/asn1/asn1_lib.c:346:1: return from a call to ASN1_STRING_new
  344.   {
  345.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
  346. > }
  347.   
  348.   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:307:1: start of procedure ASN1_STRING_set()
  305.   }
  306.   
  307. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
  308.   {
  309.       unsigned char *c;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/asn1/asn1_lib.c:322:13: Skipping ERR_put_error(): empty list of specs
  320.           str->data = OPENSSL_realloc(c, len + 1);
  321.           if (str->data == NULL) {
  322.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
                     ^
  323.               str->data = c;
  324.               return (0);

crypto/asn1/asn1_lib.c:323:13: 
  321.           if (str->data == NULL) {
  322.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
  323. >             str->data = c;
  324.               return (0);
  325.           }

crypto/asn1/asn1_lib.c:324:13: 
  322.               ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
  323.               str->data = c;
  324. >             return (0);
  325.           }
  326.       }

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

crypto/ts/ts_rsp_sign.c:871:47: Taking true 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:872:9: Skipping ERR_put_error(): empty list of specs
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;
874.       }

crypto/ts/ts_rsp_sign.c:880:2: 
878.                                         NID_id_smime_aa_signingCertificate,
879.                                         V_ASN1_SEQUENCE, seq);
880. >  err:
881.       ASN1_STRING_free(seq);
882.       OPENSSL_free(pp);

crypto/ts/ts_rsp_sign.c:881:5: 
879.                                         V_ASN1_SEQUENCE, seq);
880.    err:
881. >     ASN1_STRING_free(seq);
882.       OPENSSL_free(pp);
883.   

crypto/asn1/asn1_lib.c:361:1: start of procedure ASN1_STRING_free()
  359.   }
  360.   
  361. > void ASN1_STRING_free(ASN1_STRING *a)
  362.   {
  363.       if (a == NULL)

crypto/asn1/asn1_lib.c:363:9: Taking false branch
  361.   void ASN1_STRING_free(ASN1_STRING *a)
  362.   {
  363.       if (a == NULL)
                 ^
  364.           return;
  365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))

crypto/asn1/asn1_lib.c:365:11: Taking false branch
  363.       if (a == NULL)
  364.           return;
  365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
                   ^
  366.           OPENSSL_free(a->data);
  367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))

crypto/asn1/asn1_lib.c:367:11: Taking false branch
  365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  366.           OPENSSL_free(a->data);
  367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
                   ^
  368.           OPENSSL_free(a);
  369.   }

crypto/asn1/asn1_lib.c:367:5: 
  365.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  366.           OPENSSL_free(a->data);
  367. >     if (!(a->flags & ASN1_STRING_FLAG_EMBED))
  368.           OPENSSL_free(a);
  369.   }

crypto/asn1/asn1_lib.c:369:1: return from a call to ASN1_STRING_free
  367.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
  368.           OPENSSL_free(a);
  369. > }
  370.   
  371.   void ASN1_STRING_clear_free(ASN1_STRING *a)
