crypto/asn1/tasn_new.c:286: error: MEMORY_LEAK
  memory dynamically allocated by call to `sk_ASN1_VALUE_new_null()` at line 269, column 17 is not reachable after line 286, column 1.
Showing all 60 steps of the trace


crypto/asn1/tasn_new.c:242:1: start of procedure asn1_template_new()
240.   }
241.   
242. > static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
243.   {
244.       const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);

crypto/asn1/tasn_new.c:244:5: 
242.   static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
243.   {
244. >     const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
245.       int embed = tt->flags & ASN1_TFLG_EMBED;
246.       ASN1_VALUE *tval;

crypto/asn1/tasn_new.c:245:5: 
243.   {
244.       const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
245. >     int embed = tt->flags & ASN1_TFLG_EMBED;
246.       ASN1_VALUE *tval;
247.       int ret;

crypto/asn1/tasn_new.c:248:9: Taking true branch
246.       ASN1_VALUE *tval;
247.       int ret;
248.       if (embed) {
               ^
249.           tval = (ASN1_VALUE *)pval;
250.           pval = &tval;

crypto/asn1/tasn_new.c:249:9: 
247.       int ret;
248.       if (embed) {
249. >         tval = (ASN1_VALUE *)pval;
250.           pval = &tval;
251.       }

crypto/asn1/tasn_new.c:250:9: 
248.       if (embed) {
249.           tval = (ASN1_VALUE *)pval;
250. >         pval = &tval;
251.       }
252.       if (tt->flags & ASN1_TFLG_OPTIONAL) {

crypto/asn1/tasn_new.c:252:9: Taking false branch
250.           pval = &tval;
251.       }
252.       if (tt->flags & ASN1_TFLG_OPTIONAL) {
               ^
253.           asn1_template_clear(pval, tt);
254.           return 1;

crypto/asn1/tasn_new.c:258:9: Taking false branch
256.       /* If ANY DEFINED BY nothing to do */
257.   
258.       if (tt->flags & ASN1_TFLG_ADB_MASK) {
               ^
259.           *pval = NULL;
260.           return 1;

crypto/asn1/tasn_new.c:267:9: Taking true branch
265.   #endif
266.       /* If SET OF or SEQUENCE OF, its a STACK */
267.       if (tt->flags & ASN1_TFLG_SK_MASK) {
               ^
268.           STACK_OF(ASN1_VALUE) *skval;
269.           skval = sk_ASN1_VALUE_new_null();

crypto/asn1/tasn_new.c:269:9: 
267.       if (tt->flags & ASN1_TFLG_SK_MASK) {
268.           STACK_OF(ASN1_VALUE) *skval;
269. >         skval = sk_ASN1_VALUE_new_null();
270.           if (!skval) {
271.               ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);

include/openssl/asn1t.h:967:1: start of procedure sk_ASN1_VALUE_new_null()
  965.   DECLARE_ASN1_ITEM(ZLONG)
  966.   
  967. > DEFINE_STACK_OF(ASN1_VALUE)
  968.   
  969.   /* Functions used internally by the ASN1 code */

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.   #ifdef 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/stack/stack.c:154:9: Taking false 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:156:9: 
      154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      155.           goto err;
      156. >     if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      157.           goto err;
      158.       ret->comp = c;

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.   #ifdef 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/stack/stack.c:156:9: Taking false branch
      154.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      155.           goto err;
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
                     ^
      157.           goto err;
      158.       ret->comp = c;

crypto/stack/stack.c:158:5: 
      156.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      157.           goto err;
      158. >     ret->comp = c;
      159.       ret->num_alloc = MIN_NODES;
      160.       return (ret);

crypto/stack/stack.c:159:5: 
      157.           goto err;
      158.       ret->comp = c;
      159. >     ret->num_alloc = MIN_NODES;
      160.       return (ret);
      161.   

crypto/stack/stack.c:160:5: 
      158.       ret->comp = c;
      159.       ret->num_alloc = MIN_NODES;
      160. >     return (ret);
      161.   
      162.    err:

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/asn1t.h:967:1: return from a call to sk_ASN1_VALUE_new_null
  965.   DECLARE_ASN1_ITEM(ZLONG)
  966.   
  967. > DEFINE_STACK_OF(ASN1_VALUE)
  968.   
  969.   /* Functions used internally by the ASN1 code */

crypto/asn1/tasn_new.c:270:14: Taking false branch
268.           STACK_OF(ASN1_VALUE) *skval;
269.           skval = sk_ASN1_VALUE_new_null();
270.           if (!skval) {
                    ^
271.               ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
272.               ret = 0;

crypto/asn1/tasn_new.c:275:9: 
273.               goto done;
274.           }
275. >         *pval = (ASN1_VALUE *)skval;
276.           ret = 1;
277.           goto done;

crypto/asn1/tasn_new.c:276:9: 
274.           }
275.           *pval = (ASN1_VALUE *)skval;
276. >         ret = 1;
277.           goto done;
278.       }

crypto/asn1/tasn_new.c:281:2: 
279.       /* Otherwise pass it back to the item routine */
280.       ret = asn1_item_embed_new(pval, it, embed);
281. >  done:
282.   #ifdef CRYPTO_MDEBUG
283.       OPENSSL_mem_debug_pop();

crypto/asn1/tasn_new.c:285:5: 
283.       OPENSSL_mem_debug_pop();
284.   #endif
285. >     return ret;
286.   }
287.   

crypto/asn1/tasn_new.c:286:1: return from a call to asn1_template_new
284.   #endif
285.       return ret;
286. > }
287.   
288.   static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
