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


crypto/asn1/tasn_new.c:197:1: start of procedure asn1_template_new()
195.   }
196.   
197. > static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
198.   {
199.       const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);

crypto/asn1/tasn_new.c:199:5: 
197.   static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
198.   {
199. >     const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
200.       int embed = tt->flags & ASN1_TFLG_EMBED;
201.       ASN1_VALUE *tval;

crypto/asn1/tasn_new.c:200:5: 
198.   {
199.       const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
200. >     int embed = tt->flags & ASN1_TFLG_EMBED;
201.       ASN1_VALUE *tval;
202.       int ret;

crypto/asn1/tasn_new.c:203:9: Taking true branch
201.       ASN1_VALUE *tval;
202.       int ret;
203.       if (embed) {
               ^
204.           tval = (ASN1_VALUE *)pval;
205.           pval = &tval;

crypto/asn1/tasn_new.c:204:9: 
202.       int ret;
203.       if (embed) {
204. >         tval = (ASN1_VALUE *)pval;
205.           pval = &tval;
206.       }

crypto/asn1/tasn_new.c:205:9: 
203.       if (embed) {
204.           tval = (ASN1_VALUE *)pval;
205. >         pval = &tval;
206.       }
207.       if (tt->flags & ASN1_TFLG_OPTIONAL) {

crypto/asn1/tasn_new.c:207:9: Taking false branch
205.           pval = &tval;
206.       }
207.       if (tt->flags & ASN1_TFLG_OPTIONAL) {
               ^
208.           asn1_template_clear(pval, tt);
209.           return 1;

crypto/asn1/tasn_new.c:213:9: Taking false branch
211.       /* If ANY DEFINED BY nothing to do */
212.   
213.       if (tt->flags & ASN1_TFLG_ADB_MASK) {
               ^
214.           *pval = NULL;
215.           return 1;

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

crypto/asn1/tasn_new.c:224:9: 
222.       if (tt->flags & ASN1_TFLG_SK_MASK) {
223.           STACK_OF(ASN1_VALUE) *skval;
224. >         skval = sk_ASN1_VALUE_new_null();
225.           if (!skval) {
226.               ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);

include/openssl/asn1t.h:928:1: start of procedure sk_ASN1_VALUE_new_null()
  926.   # endif
  927.   
  928. > DEFINE_STACK_OF(ASN1_VALUE)
  929.   
  930.   /* Functions used internally by the ASN1 code */

crypto/stack/stack.c:112:1: start of procedure OPENSSL_sk_new_null()
    110.   }
    111.   
    112. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    113.   {
    114.       return OPENSSL_zalloc(sizeof(OPENSSL_STACK));

crypto/stack/stack.c:114:5: 
    112.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    113.   {
    114. >     return OPENSSL_zalloc(sizeof(OPENSSL_STACK));
    115.   }
    116.   

crypto/mem.c:218:1: start of procedure CRYPTO_zalloc()
      216.   }
      217.   
      218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      219.   {
      220.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:220:5: 
      218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      219.   {
      220. >     void *ret = CRYPTO_malloc(num, file, line);
      221.   
      222.       FAILTEST();

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
        187.   #endif
        188.   
        189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        190.   {
        191.       void *ret = NULL;

crypto/mem.c:191:5: 
        189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        190.   {
        191. >     void *ret = NULL;
        192.   
        193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
        192.   
        193.       INCREMENT(malloc_count);
        194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                       ^
        195.           return malloc_impl(num, file, line);
        196.   

crypto/mem.c:197:9: Taking false branch
        195.           return malloc_impl(num, file, line);
        196.   
        197.       if (num == 0)
                       ^
        198.           return NULL;
        199.   

crypto/mem.c:201:5: 
        199.   
        200.       FAILTEST();
        201. >     allow_customize = 0;
        202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
        209.       }
        210.   #else
        211. >     (void)(file); (void)(line);
        212.       ret = malloc(num);
        213.   #endif

crypto/mem.c:211:19: 
        209.       }
        210.   #else
        211. >     (void)(file); (void)(line);
        212.       ret = malloc(num);
        213.   #endif

crypto/mem.c:212:5: 
        210.   #else
        211.       (void)(file); (void)(line);
        212. >     ret = malloc(num);
        213.   #endif
        214.   

crypto/mem.c:215:5: 
        213.   #endif
        214.   
        215. >     return ret;
        216.   }
        217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
        214.   
        215.       return ret;
        216. > }
        217.   
        218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:223:9: Taking true branch
      221.   
      222.       FAILTEST();
      223.       if (ret != NULL)
                     ^
      224.           memset(ret, 0, num);
      225.       return ret;

crypto/mem.c:224:9: 
      222.       FAILTEST();
      223.       if (ret != NULL)
      224. >         memset(ret, 0, num);
      225.       return ret;
      226.   }

crypto/mem.c:225:5: 
      223.       if (ret != NULL)
      224.           memset(ret, 0, num);
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
      224.           memset(ret, 0, num);
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/stack/stack.c:115:1: return from a call to OPENSSL_sk_new_null
    113.   {
    114.       return OPENSSL_zalloc(sizeof(OPENSSL_STACK));
    115. > }
    116.   
    117.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

include/openssl/asn1t.h:928:1: return from a call to sk_ASN1_VALUE_new_null
  926.   # endif
  927.   
  928. > DEFINE_STACK_OF(ASN1_VALUE)
  929.   
  930.   /* Functions used internally by the ASN1 code */

crypto/asn1/tasn_new.c:225:14: Taking false branch
223.           STACK_OF(ASN1_VALUE) *skval;
224.           skval = sk_ASN1_VALUE_new_null();
225.           if (!skval) {
                    ^
226.               ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
227.               ret = 0;

crypto/asn1/tasn_new.c:230:9: 
228.               goto done;
229.           }
230. >         *pval = (ASN1_VALUE *)skval;
231.           ret = 1;
232.           goto done;

crypto/asn1/tasn_new.c:231:9: 
229.           }
230.           *pval = (ASN1_VALUE *)skval;
231. >         ret = 1;
232.           goto done;
233.       }

crypto/asn1/tasn_new.c:236:2: 
234.       /* Otherwise pass it back to the item routine */
235.       ret = asn1_item_embed_new(pval, it, embed);
236. >  done:
237.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
238.       OPENSSL_mem_debug_pop();

crypto/asn1/tasn_new.c:240:5: 
238.       OPENSSL_mem_debug_pop();
239.   #endif
240. >     return ret;
241.   }
242.   

crypto/asn1/tasn_new.c:241:1: return from a call to asn1_template_new
239.   #endif
240.       return ret;
241. > }
242.   
243.   static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)

static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
    const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
    int embed = tt->flags & ASN1_TFLG_EMBED;
    ASN1_VALUE *tval;
    int ret;
    if (embed) {
        tval = (ASN1_VALUE *)pval;
        pval = &tval;
    }
    if (tt->flags & ASN1_TFLG_OPTIONAL) {
        asn1_template_clear(pval, tt);
        return 1;
    }
    if (tt->flags & ASN1_TFLG_ADB_MASK) {
        *pval = NULL;
        return 1;
    }
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    OPENSSL_mem_debug_push(tt->field_name
            ? tt->field_name : "asn1_template_new");
#endif
    if (tt->flags & ASN1_TFLG_SK_MASK) {
        STACK_OF(ASN1_VALUE) *skval;
        skval = sk_ASN1_VALUE_new_null();
        if (!skval) {
            ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
            ret = 0;
            goto done;
        }
        *pval = (ASN1_VALUE *)skval;
        ret = 1;
        goto done;
    }
    ret = asn1_item_embed_new(pval, it, embed);
 done:
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    OPENSSL_mem_debug_pop();
#endif
    return ret;
}
['static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)\n{\n    const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);\n    int embed = tt->flags & ASN1_TFLG_EMBED;\n    ASN1_VALUE *tval;\n    int ret;\n    if (embed) {\n        tval = (ASN1_VALUE *)pval;\n        pval = &tval;\n    }\n    if (tt->flags & ASN1_TFLG_OPTIONAL) {\n        asn1_template_clear(pval, tt);\n        return 1;\n    }\n    if (tt->flags & ASN1_TFLG_ADB_MASK) {\n        *pval = NULL;\n        return 1;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    OPENSSL_mem_debug_push(tt->field_name\n            ? tt->field_name : "asn1_template_new");\n#endif\n    if (tt->flags & ASN1_TFLG_SK_MASK) {\n        STACK_OF(ASN1_VALUE) *skval;\n        skval = sk_ASN1_VALUE_new_null();\n        if (!skval) {\n            ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);\n            ret = 0;\n            goto done;\n        }\n        *pval = (ASN1_VALUE *)skval;\n        ret = 1;\n        goto done;\n    }\n    ret = asn1_item_embed_new(pval, it, embed);\n done:\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    OPENSSL_mem_debug_pop();\n#endif\n    return ret;\n}', 'DEFINE_STACK_OF(ASN1_VALUE)', 'OPENSSL_STACK *OPENSSL_sk_new_null(void)\n{\n    return OPENSSL_zalloc(sizeof(OPENSSL_STACK));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']