crypto/engine/eng_lib.c:177: error: MEMORY_LEAK
  memory dynamically allocated by call to `int_cleanup_item()` at line 175, column 12 is not reachable after line 177, column 9.
Showing all 43 steps of the trace


crypto/engine/eng_lib.c:170:1: start of procedure engine_cleanup_add_first()
168.   }
169.   
170. > void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb)
171.   {
172.       ENGINE_CLEANUP_ITEM *item;

crypto/engine/eng_lib.c:173:10: 
171.   {
172.       ENGINE_CLEANUP_ITEM *item;
173. >     if (!int_cleanup_check(1))
174.           return;
175.       item = int_cleanup_item(cb);

crypto/engine/eng_lib.c:151:1: start of procedure int_cleanup_check()
  149.    */
  150.   static STACK_OF(ENGINE_CLEANUP_ITEM) *cleanup_stack = NULL;
  151. > static int int_cleanup_check(int create)
  152.   {
  153.       if (cleanup_stack)

crypto/engine/eng_lib.c:153:9: Taking true branch
  151.   static int int_cleanup_check(int create)
  152.   {
  153.       if (cleanup_stack)
                 ^
  154.           return 1;
  155.       if (!create)

crypto/engine/eng_lib.c:154:9: 
  152.   {
  153.       if (cleanup_stack)
  154. >         return 1;
  155.       if (!create)
  156.           return 0;

crypto/engine/eng_lib.c:159:1: return from a call to int_cleanup_check
  157.       cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null();
  158.       return (cleanup_stack ? 1 : 0);
  159. > }
  160.   
  161.   static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)

crypto/engine/eng_lib.c:173:10: Taking false branch
171.   {
172.       ENGINE_CLEANUP_ITEM *item;
173.       if (!int_cleanup_check(1))
                ^
174.           return;
175.       item = int_cleanup_item(cb);

crypto/engine/eng_lib.c:175:5: 
173.       if (!int_cleanup_check(1))
174.           return;
175. >     item = int_cleanup_item(cb);
176.       if (item)
177.           sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);

crypto/engine/eng_lib.c:161:1: start of procedure int_cleanup_item()
  159.   }
  160.   
  161. > static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
  162.   {
  163.       ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));

crypto/engine/eng_lib.c:163:5: 
  161.   static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
  162.   {
  163. >     ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));
  164.       if (item == NULL)
  165.           return 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/engine/eng_lib.c:164:9: Taking false branch
  162.   {
  163.       ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item));
  164.       if (item == NULL)
                 ^
  165.           return NULL;
  166.       item->cb = cb;

crypto/engine/eng_lib.c:166:5: 
  164.       if (item == NULL)
  165.           return NULL;
  166. >     item->cb = cb;
  167.       return item;
  168.   }

crypto/engine/eng_lib.c:167:5: 
  165.           return NULL;
  166.       item->cb = cb;
  167. >     return item;
  168.   }
  169.   

crypto/engine/eng_lib.c:168:1: return from a call to int_cleanup_item
  166.       item->cb = cb;
  167.       return item;
  168. > }
  169.   
  170.   void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb)

crypto/engine/eng_lib.c:176:9: Taking true branch
174.           return;
175.       item = int_cleanup_item(cb);
176.       if (item)
               ^
177.           sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
178.   }

crypto/engine/eng_lib.c:177:9: 
175.       item = int_cleanup_item(cb);
176.       if (item)
177. >         sk_ENGINE_CLEANUP_ITEM_insert(cleanup_stack, item, 0);
178.   }
179.   

crypto/engine/eng_int.h:107:1: start of procedure sk_ENGINE_CLEANUP_ITEM_insert()
  105.       ENGINE_CLEANUP_CB *cb;
  106.   } ENGINE_CLEANUP_ITEM;
  107. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM)
  108.   void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb);
  109.   void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb);

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/engine/eng_int.h:107:1: return from a call to sk_ENGINE_CLEANUP_ITEM_insert
  105.       ENGINE_CLEANUP_CB *cb;
  106.   } ENGINE_CLEANUP_ITEM;
  107. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM)
  108.   void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb);
  109.   void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb);
