crypto/asn1/tasn_new.c:151: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 146, column 21 is not reachable after line 151, column 25.
Showing all 42 steps of the trace


crypto/asn1/tasn_new.c:91:1: start of procedure asn1_item_embed_new()
89.   }
90.   
91. > int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
92.   {
93.       const ASN1_TEMPLATE *tt = NULL;

crypto/asn1/tasn_new.c:93:5: 
91.   int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
92.   {
93. >     const ASN1_TEMPLATE *tt = NULL;
94.       const ASN1_EXTERN_FUNCS *ef;
95.       const ASN1_AUX *aux = it->funcs;

crypto/asn1/tasn_new.c:95:5: 
93.       const ASN1_TEMPLATE *tt = NULL;
94.       const ASN1_EXTERN_FUNCS *ef;
95. >     const ASN1_AUX *aux = it->funcs;
96.       ASN1_aux_cb *asn1_cb;
97.       ASN1_VALUE **pseqval;

crypto/asn1/tasn_new.c:99:9: Taking true branch
97.       ASN1_VALUE **pseqval;
98.       int i;
99.       if (aux && aux->asn1_cb)
               ^
100.           asn1_cb = aux->asn1_cb;
101.       else

crypto/asn1/tasn_new.c:99:16: Taking true branch
97.       ASN1_VALUE **pseqval;
98.       int i;
99.       if (aux && aux->asn1_cb)
                      ^
100.           asn1_cb = aux->asn1_cb;
101.       else

crypto/asn1/tasn_new.c:100:9: 
98.       int i;
99.       if (aux && aux->asn1_cb)
100. >         asn1_cb = aux->asn1_cb;
101.       else
102.           asn1_cb = 0;

crypto/asn1/tasn_new.c:108:5: 
106.   #endif
107.   
108. >     switch (it->itype) {
109.   
110.       case ASN1_ITYPE_EXTERN:

crypto/asn1/tasn_new.c:110:5: Switch condition is false. Skipping switch case
108.       switch (it->itype) {
109.   
110.       case ASN1_ITYPE_EXTERN:
           ^
111.           ef = it->funcs;
112.           if (ef && ef->asn1_ex_new) {

crypto/asn1/tasn_new.c:118:5: Switch condition is false. Skipping switch case
116.           break;
117.   
118.       case ASN1_ITYPE_PRIMITIVE:
           ^
119.           if (it->templates) {
120.               if (!asn1_template_new(pval, it->templates))

crypto/asn1/tasn_new.c:126:5: Switch condition is false. Skipping switch case
124.           break;
125.   
126.       case ASN1_ITYPE_MSTRING:
           ^
127.           if (!asn1_primitive_new(pval, it, embed))
128.               goto memerr;

crypto/asn1/tasn_new.c:131:5: Switch condition is true. Entering switch case
129.           break;
130.   
131.       case ASN1_ITYPE_CHOICE:
           ^
132.           if (asn1_cb) {
133.               i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);

crypto/asn1/tasn_new.c:132:13: Taking true branch
130.   
131.       case ASN1_ITYPE_CHOICE:
132.           if (asn1_cb) {
                   ^
133.               i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
134.               if (!i)

crypto/asn1/tasn_new.c:133:13: Skipping __function_pointer__(): unresolved function pointer
131.       case ASN1_ITYPE_CHOICE:
132.           if (asn1_cb) {
133.               i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
                   ^
134.               if (!i)
135.                   goto auxerr;

crypto/asn1/tasn_new.c:134:18: Taking false branch
132.           if (asn1_cb) {
133.               i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
134.               if (!i)
                        ^
135.                   goto auxerr;
136.               if (i == 2) {

crypto/asn1/tasn_new.c:136:17: Taking false branch
134.               if (!i)
135.                   goto auxerr;
136.               if (i == 2) {
                       ^
137.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
138.                   OPENSSL_mem_debug_pop();

crypto/asn1/tasn_new.c:143:13: Taking false branch
141.               }
142.           }
143.           if (embed) {
                   ^
144.               memset(*pval, 0, it->size);
145.           } else {

crypto/asn1/tasn_new.c:146:13: 
144.               memset(*pval, 0, it->size);
145.           } else {
146. >             *pval = OPENSSL_zalloc(it->size);
147.               if (*pval == NULL)
148.                   goto memerr;

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/tasn_new.c:147:17: Taking false branch
145.           } else {
146.               *pval = OPENSSL_zalloc(it->size);
147.               if (*pval == NULL)
                       ^
148.                   goto memerr;
149.           }

crypto/asn1/tasn_new.c:150:9: 
148.                   goto memerr;
149.           }
150. >         asn1_set_choice_selector(pval, -1, it);
151.           if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
152.               goto auxerr;

crypto/asn1/tasn_utl.c:87:1: start of procedure asn1_set_choice_selector()
  85.    */
  86.   
  87. > int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
  88.                                const ASN1_ITEM *it)
  89.   {

crypto/asn1/tasn_utl.c:91:5: 
  89.   {
  90.       int *sel, ret;
  91. >     sel = offset2ptr(*pval, it->utype);
  92.       ret = *sel;
  93.       *sel = value;

crypto/asn1/tasn_utl.c:92:5: 
  90.       int *sel, ret;
  91.       sel = offset2ptr(*pval, it->utype);
  92. >     ret = *sel;
  93.       *sel = value;
  94.       return ret;

crypto/asn1/tasn_utl.c:93:5: 
  91.       sel = offset2ptr(*pval, it->utype);
  92.       ret = *sel;
  93. >     *sel = value;
  94.       return ret;
  95.   }

crypto/asn1/tasn_utl.c:94:5: 
  92.       ret = *sel;
  93.       *sel = value;
  94. >     return ret;
  95.   }
  96.   

crypto/asn1/tasn_utl.c:95:1: return from a call to asn1_set_choice_selector
  93.       *sel = value;
  94.       return ret;
  95. > }
  96.   
  97.   /*

crypto/asn1/tasn_new.c:151:13: Taking true branch
149.           }
150.           asn1_set_choice_selector(pval, -1, it);
151.           if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
                   ^
152.               goto auxerr;
153.           break;

crypto/asn1/tasn_new.c:151:25: Skipping __function_pointer__(): unresolved function pointer
149.           }
150.           asn1_set_choice_selector(pval, -1, it);
151.           if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
                               ^
152.               goto auxerr;
153.           break;
