crypto/ts/ts_rsp_sign.c:266: error: MEMORY_LEAK
  memory dynamically allocated by call to `OBJ_dup()` at line 258, column 17 is not reachable after line 266, column 5.
Showing all 109 steps of the trace


crypto/ts/ts_rsp_sign.c:251:1: start of procedure TS_RESP_CTX_add_policy()
249.   }
250.   
251. > int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy)
252.   {
253.       ASN1_OBJECT *copy = NULL;

crypto/ts/ts_rsp_sign.c:253:5: 
251.   int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy)
252.   {
253. >     ASN1_OBJECT *copy = NULL;
254.   
255.       if (ctx->policies == NULL

crypto/ts/ts_rsp_sign.c:255:9: Taking false branch
253.       ASN1_OBJECT *copy = NULL;
254.   
255.       if (ctx->policies == NULL
               ^
256.           && (ctx->policies = sk_ASN1_OBJECT_new_null()) == NULL)
257.           goto err;

crypto/ts/ts_rsp_sign.c:258:9: 
256.           && (ctx->policies = sk_ASN1_OBJECT_new_null()) == NULL)
257.           goto err;
258. >     if ((copy = OBJ_dup(policy)) == NULL)
259.           goto err;
260.       if (!sk_ASN1_OBJECT_push(ctx->policies, copy))

crypto/objects/obj_lib.c:65:1: start of procedure OBJ_dup()
  63.   #include "internal/asn1_int.h"
  64.   
  65. > ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
  66.   {
  67.       ASN1_OBJECT *r;

crypto/objects/obj_lib.c:69:5: 
  67.       ASN1_OBJECT *r;
  68.       int i;
  69. >     char *ln = NULL, *sn = NULL;
  70.       unsigned char *data = NULL;
  71.   

crypto/objects/obj_lib.c:70:5: 
  68.       int i;
  69.       char *ln = NULL, *sn = NULL;
  70. >     unsigned char *data = NULL;
  71.   
  72.       if (o == NULL)

crypto/objects/obj_lib.c:72:9: Taking false branch
  70.       unsigned char *data = NULL;
  71.   
  72.       if (o == NULL)
                ^
  73.           return (NULL);
  74.       if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))

crypto/objects/obj_lib.c:74:11: Taking false branch
  72.       if (o == NULL)
  73.           return (NULL);
  74.       if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
                  ^
  75.           return ((ASN1_OBJECT *)o); /* XXX: ugh! Why? What kind of duplication
  76.                                       * is this??? */

crypto/objects/obj_lib.c:78:5: 
  76.                                       * is this??? */
  77.   
  78. >     r = ASN1_OBJECT_new();
  79.       if (r == NULL) {
  80.           OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);

crypto/asn1/a_object.c:366:1: start of procedure ASN1_OBJECT_new()
    364.   }
    365.   
    366. > ASN1_OBJECT *ASN1_OBJECT_new(void)
    367.   {
    368.       ASN1_OBJECT *ret;

crypto/asn1/a_object.c:370:5: 
    368.       ASN1_OBJECT *ret;
    369.   
    370. >     ret = OPENSSL_zalloc(sizeof(*ret));
    371.       if (ret == NULL) {
    372.           ASN1err(ASN1_F_ASN1_OBJECT_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/a_object.c:371:9: Taking false branch
    369.   
    370.       ret = OPENSSL_zalloc(sizeof(*ret));
    371.       if (ret == NULL) {
                   ^
    372.           ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
    373.           return (NULL);

crypto/asn1/a_object.c:375:5: 
    373.           return (NULL);
    374.       }
    375. >     ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376.       return (ret);
    377.   }

crypto/asn1/a_object.c:376:5: 
    374.       }
    375.       ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376. >     return (ret);
    377.   }
    378.   

crypto/asn1/a_object.c:377:1: return from a call to ASN1_OBJECT_new
    375.       ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;
    376.       return (ret);
    377. > }
    378.   
    379.   void ASN1_OBJECT_free(ASN1_OBJECT *a)

crypto/objects/obj_lib.c:79:9: Taking false branch
  77.   
  78.       r = ASN1_OBJECT_new();
  79.       if (r == NULL) {
                ^
  80.           OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);
  81.           return (NULL);

crypto/objects/obj_lib.c:83:5: 
  81.           return (NULL);
  82.       }
  83. >     data = OPENSSL_malloc(o->length);
  84.       if (data == NULL)
  85.           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/objects/obj_lib.c:84:9: Taking false branch
  82.       }
  83.       data = OPENSSL_malloc(o->length);
  84.       if (data == NULL)
                ^
  85.           goto err;
  86.       if (o->data != NULL)

crypto/objects/obj_lib.c:86:9: Taking true branch
  84.       if (data == NULL)
  85.           goto err;
  86.       if (o->data != NULL)
                ^
  87.           memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */

crypto/objects/obj_lib.c:87:9: 
  85.           goto err;
  86.       if (o->data != NULL)
  87. >         memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */
  89.       r->data = data;

crypto/objects/obj_lib.c:89:5: 
  87.           memcpy(data, o->data, o->length);
  88.       /* once data attached to object it remains const */
  89. >     r->data = data;
  90.       r->length = o->length;
  91.       r->nid = o->nid;

crypto/objects/obj_lib.c:90:5: 
  88.       /* once data attached to object it remains const */
  89.       r->data = data;
  90. >     r->length = o->length;
  91.       r->nid = o->nid;
  92.       r->ln = r->sn = NULL;

crypto/objects/obj_lib.c:91:5: 
  89.       r->data = data;
  90.       r->length = o->length;
  91. >     r->nid = o->nid;
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {

crypto/objects/obj_lib.c:92:5: 
  90.       r->length = o->length;
  91.       r->nid = o->nid;
  92. >     r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
  94.           i = strlen(o->ln) + 1;

crypto/objects/obj_lib.c:93:9: Taking true branch
  91.       r->nid = o->nid;
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
                ^
  94.           i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);

crypto/objects/obj_lib.c:94:9: 
  92.       r->ln = r->sn = NULL;
  93.       if (o->ln != NULL) {
  94. >         i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)

crypto/objects/obj_lib.c:95:9: 
  93.       if (o->ln != NULL) {
  94.           i = strlen(o->ln) + 1;
  95. >         ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)
  97.               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/objects/obj_lib.c:96:13: Taking false branch
  94.           i = strlen(o->ln) + 1;
  95.           ln = OPENSSL_malloc(i);
  96.           if (ln == NULL)
                    ^
  97.               goto err;
  98.           memcpy(ln, o->ln, i);

crypto/objects/obj_lib.c:98:9: 
  96.           if (ln == NULL)
  97.               goto err;
  98. >         memcpy(ln, o->ln, i);
  99.           r->ln = ln;
  100.       }

crypto/objects/obj_lib.c:99:9: 
  97.               goto err;
  98.           memcpy(ln, o->ln, i);
  99. >         r->ln = ln;
  100.       }
  101.   

crypto/objects/obj_lib.c:102:9: Taking true branch
  100.       }
  101.   
  102.       if (o->sn != NULL) {
                 ^
  103.           i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);

crypto/objects/obj_lib.c:103:9: 
  101.   
  102.       if (o->sn != NULL) {
  103. >         i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)

crypto/objects/obj_lib.c:104:9: 
  102.       if (o->sn != NULL) {
  103.           i = strlen(o->sn) + 1;
  104. >         sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)
  106.               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/objects/obj_lib.c:105:13: Taking false branch
  103.           i = strlen(o->sn) + 1;
  104.           sn = OPENSSL_malloc(i);
  105.           if (sn == NULL)
                     ^
  106.               goto err;
  107.           memcpy(sn, o->sn, i);

crypto/objects/obj_lib.c:107:9: 
  105.           if (sn == NULL)
  106.               goto err;
  107. >         memcpy(sn, o->sn, i);
  108.           r->sn = sn;
  109.       }

crypto/objects/obj_lib.c:108:9: 
  106.               goto err;
  107.           memcpy(sn, o->sn, i);
  108. >         r->sn = sn;
  109.       }
  110.       r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |

crypto/objects/obj_lib.c:110:5: 
  108.           r->sn = sn;
  109.       }
  110. >     r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |
  111.                              ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  112.                              ASN1_OBJECT_FLAG_DYNAMIC_DATA);

crypto/objects/obj_lib.c:113:5: 
  111.                              ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
  112.                              ASN1_OBJECT_FLAG_DYNAMIC_DATA);
  113. >     return (r);
  114.    err:
  115.       OBJerr(OBJ_F_OBJ_DUP, ERR_R_MALLOC_FAILURE);

crypto/objects/obj_lib.c:121:1: return from a call to OBJ_dup
  119.       OPENSSL_free(r);
  120.       return (NULL);
  121. > }
  122.   
  123.   int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)

crypto/ts/ts_rsp_sign.c:258:9: Taking false branch
256.           && (ctx->policies = sk_ASN1_OBJECT_new_null()) == NULL)
257.           goto err;
258.       if ((copy = OBJ_dup(policy)) == NULL)
               ^
259.           goto err;
260.       if (!sk_ASN1_OBJECT_push(ctx->policies, copy))

crypto/ts/ts_rsp_sign.c:260:10: 
258.       if ((copy = OBJ_dup(policy)) == NULL)
259.           goto err;
260. >     if (!sk_ASN1_OBJECT_push(ctx->policies, copy))
261.           goto err;
262.   

include/openssl/asn1.h:568:1: start of procedure sk_ASN1_OBJECT_push()
  566.   DECLARE_ASN1_ITEM(ASN1_OBJECT)
  567.   
  568. > DEFINE_STACK_OF(ASN1_OBJECT)
  569.   
  570.   ASN1_STRING *ASN1_STRING_new(void);

crypto/stack/stack.c:258:1: start of procedure sk_push()
    256.   }
    257.   
    258. > int sk_push(_STACK *st, void *data)
    259.   {
    260.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:260:5: 
    258.   int sk_push(_STACK *st, void *data)
    259.   {
    260. >     return (sk_insert(st, data, st->num));
    261.   }
    262.   

crypto/stack/stack.c:166:1: start of procedure sk_insert()
      164.   }
      165.   
      166. > int sk_insert(_STACK *st, void *data, int loc)
      167.   {
      168.       char **s;

crypto/stack/stack.c:170:9: Taking false branch
      168.       char **s;
      169.   
      170.       if (st == NULL)
                     ^
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {

crypto/stack/stack.c:172:9: Taking true branch
      170.       if (st == NULL)
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {
                     ^
      173.           s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);

crypto/stack/stack.c:173:9: 
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {
      173. >         s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)

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 true 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:168:9: 
        166.   {
        167.       if (str == NULL)
        168. >         return CRYPTO_malloc(num, file, line);
        169.   
        170.       if (num == 0) {

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 true branch
          121.       void *ret = NULL;
          122.   
          123.       if (num <= 0)
                         ^
          124.           return NULL;
          125.   

crypto/mem.c:124:9: 
          122.   
          123.       if (num <= 0)
          124. >         return NULL;
          125.   
          126.       allow_customize = 0;

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: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/stack/stack.c:175:13: Taking true branch
      173.           s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)
                         ^
      176.               return (0);
      177.           st->data = s;

crypto/stack/stack.c:176:13: 
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      175.           if (s == NULL)
      176. >             return (0);
      177.           st->data = s;
      178.           st->num_alloc *= 2;

crypto/stack/stack.c:190:1: return from a call to sk_insert
      188.       st->sorted = 0;
      189.       return (st->num);
      190. > }
      191.   
      192.   void *sk_delete_ptr(_STACK *st, void *p)

crypto/stack/stack.c:261:1: return from a call to sk_push
    259.   {
    260.       return (sk_insert(st, data, st->num));
    261. > }
    262.   
    263.   int sk_unshift(_STACK *st, void *data)

include/openssl/asn1.h:568:1: return from a call to sk_ASN1_OBJECT_push
  566.   DECLARE_ASN1_ITEM(ASN1_OBJECT)
  567.   
  568. > DEFINE_STACK_OF(ASN1_OBJECT)
  569.   
  570.   ASN1_STRING *ASN1_STRING_new(void);

crypto/ts/ts_rsp_sign.c:260:10: Taking true branch
258.       if ((copy = OBJ_dup(policy)) == NULL)
259.           goto err;
260.       if (!sk_ASN1_OBJECT_push(ctx->policies, copy))
                ^
261.           goto err;
262.   

crypto/ts/ts_rsp_sign.c:264:2: 
262.   
263.       return 1;
264. >  err:
265.       TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);
266.       ASN1_OBJECT_free(copy);

crypto/ts/ts_rsp_sign.c:265:5: Skipping ERR_put_error(): empty list of specs
263.       return 1;
264.    err:
265.       TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);
           ^
266.       ASN1_OBJECT_free(copy);
267.       return 0;

crypto/ts/ts_rsp_sign.c:266:5: Skipping ASN1_OBJECT_free(): empty list of specs
264.    err:
265.       TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);
266.       ASN1_OBJECT_free(copy);
           ^
267.       return 0;
268.   }

int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy)
{
    ASN1_OBJECT *copy = NULL;
    if (ctx->policies == NULL
        && (ctx->policies = sk_ASN1_OBJECT_new_null()) == NULL)
        goto err;
    if ((copy = OBJ_dup(policy)) == NULL)
        goto err;
    if (!sk_ASN1_OBJECT_push(ctx->policies, copy))
        goto err;
    return 1;
 err:
    TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);
    ASN1_OBJECT_free(copy);
    return 0;
}
['int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy)\n{\n    ASN1_OBJECT *copy = NULL;\n    if (ctx->policies == NULL\n        && (ctx->policies = sk_ASN1_OBJECT_new_null()) == NULL)\n        goto err;\n    if ((copy = OBJ_dup(policy)) == NULL)\n        goto err;\n    if (!sk_ASN1_OBJECT_push(ctx->policies, copy))\n        goto err;\n    return 1;\n err:\n    TSerr(TS_F_TS_RESP_CTX_ADD_POLICY, ERR_R_MALLOC_FAILURE);\n    ASN1_OBJECT_free(copy);\n    return 0;\n}', 'ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)\n{\n    ASN1_OBJECT *r;\n    int i;\n    char *ln = NULL, *sn = NULL;\n    unsigned char *data = NULL;\n    if (o == NULL)\n        return (NULL);\n    if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))\n        return ((ASN1_OBJECT *)o);\n    r = ASN1_OBJECT_new();\n    if (r == NULL) {\n        OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);\n        return (NULL);\n    }\n    data = OPENSSL_malloc(o->length);\n    if (data == NULL)\n        goto err;\n    if (o->data != NULL)\n        memcpy(data, o->data, o->length);\n    r->data = data;\n    r->length = o->length;\n    r->nid = o->nid;\n    r->ln = r->sn = NULL;\n    if (o->ln != NULL) {\n        i = strlen(o->ln) + 1;\n        ln = OPENSSL_malloc(i);\n        if (ln == NULL)\n            goto err;\n        memcpy(ln, o->ln, i);\n        r->ln = ln;\n    }\n    if (o->sn != NULL) {\n        i = strlen(o->sn) + 1;\n        sn = OPENSSL_malloc(i);\n        if (sn == NULL)\n            goto err;\n        memcpy(sn, o->sn, i);\n        r->sn = sn;\n    }\n    r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |\n                           ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |\n                           ASN1_OBJECT_FLAG_DYNAMIC_DATA);\n    return (r);\n err:\n    OBJerr(OBJ_F_OBJ_DUP, ERR_R_MALLOC_FAILURE);\n    OPENSSL_free(ln);\n    OPENSSL_free(sn);\n    OPENSSL_free(data);\n    OPENSSL_free(r);\n    return (NULL);\n}', 'ASN1_OBJECT *ASN1_OBJECT_new(void)\n{\n    ASN1_OBJECT *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->flags = ASN1_OBJECT_FLAG_DYNAMIC;\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}', '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}', 'DEFINE_STACK_OF(ASN1_OBJECT)', 'int sk_push(_STACK *st, void *data)\n{\n    return (sk_insert(st, data, st->num));\n}', 'int sk_insert(_STACK *st, void *data, int loc)\n{\n    char **s;\n    if (st == NULL)\n        return 0;\n    if (st->num_alloc <= st->num + 1) {\n        s = OPENSSL_realloc((char *)st->data,\n                            (unsigned int)sizeof(char *) * st->num_alloc * 2);\n        if (s == NULL)\n            return (0);\n        st->data = s;\n        st->num_alloc *= 2;\n    }\n    if ((loc >= (int)st->num) || (loc < 0))\n        st->data[st->num] = data;\n    else {\n        memmove(&(st->data[loc + 1]),\n                &(st->data[loc]), sizeof(char *) * (st->num - loc));\n        st->data[loc] = data;\n    }\n    st->num++;\n    st->sorted = 0;\n    return (st->num);\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}']