crypto/x509/x509_lu.c:346: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 327, column 11 is not reachable after line 346, column 9.
Showing all 61 steps of the trace


crypto/x509/x509_lu.c:320:1: start of procedure X509_STORE_add_cert()
318.   }
319.   
320. > int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
321.   {
322.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:323:5: 
321.   {
322.       X509_OBJECT *obj;
323. >     int ret = 1;
324.   
325.       if (x == NULL)

crypto/x509/x509_lu.c:325:9: Taking false branch
323.       int ret = 1;
324.   
325.       if (x == NULL)
               ^
326.           return 0;
327.       obj = OPENSSL_malloc(sizeof(*obj));

crypto/x509/x509_lu.c:327:5: 
325.       if (x == NULL)
326.           return 0;
327. >     obj = OPENSSL_malloc(sizeof(*obj));
328.       if (obj == NULL) {
329.           X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);

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/x509/x509_lu.c:328:9: Taking false branch
326.           return 0;
327.       obj = OPENSSL_malloc(sizeof(*obj));
328.       if (obj == NULL) {
               ^
329.           X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
330.           return 0;

crypto/x509/x509_lu.c:332:5: 
330.           return 0;
331.       }
332. >     obj->type = X509_LU_X509;
333.       obj->data.x509 = x;
334.   

crypto/x509/x509_lu.c:333:5: 
331.       }
332.       obj->type = X509_LU_X509;
333. >     obj->data.x509 = x;
334.   
335.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);

crypto/x509/x509_lu.c:335:5: 
333.       obj->data.x509 = x;
334.   
335. >     CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
336.   
337.       X509_OBJECT_up_ref_count(obj);

crypto/lock.c:414:1: start of procedure CRYPTO_lock()
  412.   }
  413.   
  414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  415.   {
  416.   #ifdef LOCK_DEBUG

crypto/lock.c:441:9: Taking false branch
  439.       }
  440.   #endif
  441.       if (type < 0) {
                 ^
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:452:16: Taking true branch
  450.               CRYPTO_destroy_dynlockid(type);
  451.           }
  452.       } else if (locking_callback != NULL)
                        ^
  453.           locking_callback(mode, type, file, line);
  454.   }

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
  451.           }
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
                 ^
  454.   }
  455.   

crypto/lock.c:441:5: 
  439.       }
  440.   #endif
  441. >     if (type < 0) {
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:454:1: return from a call to CRYPTO_lock
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
  454. > }
  455.   
  456.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509/x509_lu.c:337:5: 
335.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
336.   
337. >     X509_OBJECT_up_ref_count(obj);
338.   
339.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {

crypto/x509/x509_lu.c:385:1: start of procedure X509_OBJECT_up_ref_count()
  383.   }
  384.   
  385. > void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  386.   {
  387.       switch (a->type) {

crypto/x509/x509_lu.c:387:5: 
  385.   void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  386.   {
  387. >     switch (a->type) {
  388.       default:
  389.           break;

crypto/x509/x509_lu.c:390:5: Switch condition is true. Entering switch case
  388.       default:
  389.           break;
  390.       case X509_LU_X509:
             ^
  391.           X509_up_ref(a->data.x509);
  392.           break;

crypto/x509/x509_lu.c:391:9: 
  389.           break;
  390.       case X509_LU_X509:
  391. >         X509_up_ref(a->data.x509);
  392.           break;
  393.       case X509_LU_CRL:

crypto/x509/x509_set.c:149:1: start of procedure X509_up_ref()
    147.   }
    148.   
    149. > void X509_up_ref(X509 *x)
    150.   {
    151.       CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);

crypto/x509/x509_set.c:151:5: 
    149.   void X509_up_ref(X509 *x)
    150.   {
    151. >     CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
    152.   }
    153.   

crypto/lock.c:456:1: start of procedure CRYPTO_add_lock()
      454.   }
      455.   
      456. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
      457.                       int line)
      458.   {

crypto/lock.c:459:5: 
      457.                       int line)
      458.   {
      459. >     int ret = 0;
      460.   
      461.       if (add_lock_callback != NULL) {

crypto/lock.c:461:9: Taking true branch
      459.       int ret = 0;
      460.   
      461.       if (add_lock_callback != NULL) {
                     ^
      462.   #ifdef LOCK_DEBUG
      463.           int before = *pointer;

crypto/lock.c:466:9: Skipping __function_pointer__(): unresolved function pointer
      464.   #endif
      465.   
      466.           ret = add_lock_callback(pointer, amount, type, file, line);
                     ^
      467.   #ifdef LOCK_DEBUG
      468.           {

crypto/lock.c:493:5: 
      491.           CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
      492.       }
      493. >     return (ret);
      494.   }
      495.   

crypto/lock.c:494:1: return from a call to CRYPTO_add_lock
      492.       }
      493.       return (ret);
      494. > }
      495.   
      496.   const char *CRYPTO_get_lock_name(int type)

crypto/x509/x509_set.c:152:1: return from a call to X509_up_ref
    150.   {
    151.       CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
    152. > }
    153.   
    154.   long X509_get_version(X509 *x)

crypto/x509/x509_lu.c:397:1: return from a call to X509_OBJECT_up_ref_count
  395.           break;
  396.       }
  397. > }
  398.   
  399.   void X509_OBJECT_free_contents(X509_OBJECT *a)

crypto/x509/x509_lu.c:339:9: Taking false branch
337.       X509_OBJECT_up_ref_count(obj);
338.   
339.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
               ^
340.           X509_OBJECT_free_contents(obj);
341.           OPENSSL_free(obj);

crypto/x509/x509_lu.c:346:9: 
344.           ret = 0;
345.       } else
346. >         sk_X509_OBJECT_push(ctx->objs, obj);
347.   
348.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

include/openssl/x509_vfy.h:122:1: start of procedure sk_X509_OBJECT_push()
  120.   
  121.   DEFINE_STACK_OF(X509_LOOKUP)
  122. > DEFINE_STACK_OF(X509_OBJECT)
  123.   
  124.   /* This is a static that defines the function interface */

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/x509_vfy.h:122:1: return from a call to sk_X509_OBJECT_push
  120.   
  121.   DEFINE_STACK_OF(X509_LOOKUP)
  122. > DEFINE_STACK_OF(X509_OBJECT)
  123.   
  124.   /* This is a static that defines the function interface */
