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


crypto/x509/x509_lu.c:361:1: start of procedure X509_STORE_add_crl()
359.   }
360.   
361. > int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
362.   {
363.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:364:5: 
362.   {
363.       X509_OBJECT *obj;
364. >     int ret = 1;
365.   
366.       if (x == NULL)

crypto/x509/x509_lu.c:366:9: Taking false branch
364.       int ret = 1;
365.   
366.       if (x == NULL)
               ^
367.           return 0;
368.       obj = OPENSSL_malloc(sizeof(*obj));

crypto/x509/x509_lu.c:368:5: 
366.       if (x == NULL)
367.           return 0;
368. >     obj = OPENSSL_malloc(sizeof(*obj));
369.       if (obj == NULL) {
370.           X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);

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.   #ifndef OPENSSL_NO_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/x509/x509_lu.c:369:9: Taking false branch
367.           return 0;
368.       obj = OPENSSL_malloc(sizeof(*obj));
369.       if (obj == NULL) {
               ^
370.           X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
371.           return 0;

crypto/x509/x509_lu.c:373:5: 
371.           return 0;
372.       }
373. >     obj->type = X509_LU_CRL;
374.       obj->data.crl = x;
375.   

crypto/x509/x509_lu.c:374:5: 
372.       }
373.       obj->type = X509_LU_CRL;
374. >     obj->data.crl = x;
375.   
376.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);

crypto/x509/x509_lu.c:376:5: 
374.       obj->data.crl = x;
375.   
376. >     CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
377.   
378.       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:378:5: 
376.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
377.   
378. >     X509_OBJECT_up_ref_count(obj);
379.   
380.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {

crypto/x509/x509_lu.c:393:1: start of procedure X509_OBJECT_up_ref_count()
  391.   }
  392.   
  393. > void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  394.   {
  395.       switch (a->type) {

crypto/x509/x509_lu.c:395:5: 
  393.   void X509_OBJECT_up_ref_count(X509_OBJECT *a)
  394.   {
  395. >     switch (a->type) {
  396.       default:
  397.           break;

crypto/x509/x509_lu.c:398:5: Switch condition is false. Skipping switch case
  396.       default:
  397.           break;
  398.       case X509_LU_X509:
             ^
  399.           X509_up_ref(a->data.x509);
  400.           break;

crypto/x509/x509_lu.c:401:5: Switch condition is true. Entering switch case
  399.           X509_up_ref(a->data.x509);
  400.           break;
  401.       case X509_LU_CRL:
             ^
  402.           X509_CRL_up_ref(a->data.crl);
  403.           break;

crypto/x509/x509_lu.c:402:9: 
  400.           break;
  401.       case X509_LU_CRL:
  402. >         X509_CRL_up_ref(a->data.crl);
  403.           break;
  404.       }

crypto/x509/x509cset.c:136:1: start of procedure X509_CRL_up_ref()
    134.   }
    135.   
    136. > void X509_CRL_up_ref(X509_CRL *crl)
    137.   {
    138.       CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);

crypto/x509/x509cset.c:138:5: 
    136.   void X509_CRL_up_ref(X509_CRL *crl)
    137.   {
    138. >     CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
    139.   }
    140.   

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/x509cset.c:139:1: return from a call to X509_CRL_up_ref
    137.   {
    138.       CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
    139. > }
    140.   
    141.   long X509_CRL_get_version(X509_CRL *crl)

crypto/x509/x509_lu.c:405:1: return from a call to X509_OBJECT_up_ref_count
  403.           break;
  404.       }
  405. > }
  406.   
  407.   void X509_OBJECT_free_contents(X509_OBJECT *a)

crypto/x509/x509_lu.c:380:9: Taking false branch
378.       X509_OBJECT_up_ref_count(obj);
379.   
380.       if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
               ^
381.           X509_OBJECT_free_contents(obj);
382.           OPENSSL_free(obj);

crypto/x509/x509_lu.c:386:9: 
384.           ret = 0;
385.       } else
386. >         sk_X509_OBJECT_push(ctx->objs, obj);
387.   
388.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

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

crypto/stack/stack.c:259:1: start of procedure sk_push()
    257.   }
    258.   
    259. > int sk_push(_STACK *st, void *data)
    260.   {
    261.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:261:5: 
    259.   int sk_push(_STACK *st, void *data)
    260.   {
    261. >     return (sk_insert(st, data, st->num));
    262.   }
    263.   

crypto/stack/stack.c:167:1: start of procedure sk_insert()
      165.   }
      166.   
      167. > int sk_insert(_STACK *st, void *data, int loc)
      168.   {
      169.       char **s;

crypto/stack/stack.c:171:9: Taking false branch
      169.       char **s;
      170.   
      171.       if (st == NULL)
                     ^
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {

crypto/stack/stack.c:173:9: Taking true branch
      171.       if (st == NULL)
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {
                     ^
      174.           s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);

crypto/stack/stack.c:174:9: 
      172.           return 0;
      173.       if (st->num_alloc <= st->num + 1) {
      174. >         s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)

crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
        164.   }
        165.   
        166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        167.   {
        168.       if (str == NULL)

crypto/mem.c:168:9: Taking true branch
        166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
        167.   {
        168.       if (str == NULL)
                       ^
        169.           return CRYPTO_malloc(num, file, line);
        170.   

crypto/mem.c:169:9: 
        167.   {
        168.       if (str == NULL)
        169. >         return CRYPTO_malloc(num, file, line);
        170.   
        171.       if (num == 0) {

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 true branch
          122.       void *ret = NULL;
          123.   
          124.       if (num <= 0)
                         ^
          125.           return NULL;
          126.   

crypto/mem.c:125:9: 
          123.   
          124.       if (num <= 0)
          125. >         return NULL;
          126.   
          127.       allow_customize = 0;

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:191:1: return from a call to CRYPTO_realloc
        189.       return realloc(str, num);
        190.   
        191. > }
        192.   
        193.   void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,

crypto/stack/stack.c:176:13: Taking true branch
      174.           s = OPENSSL_realloc((char *)st->data,
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)
                         ^
      177.               return (0);
      178.           st->data = s;

crypto/stack/stack.c:177:13: 
      175.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
      176.           if (s == NULL)
      177. >             return (0);
      178.           st->data = s;
      179.           st->num_alloc *= 2;

crypto/stack/stack.c:191:1: return from a call to sk_insert
      189.       st->sorted = 0;
      190.       return (st->num);
      191. > }
      192.   
      193.   void *sk_delete_ptr(_STACK *st, void *p)

crypto/stack/stack.c:262:1: return from a call to sk_push
    260.   {
    261.       return (sk_insert(st, data, st->num));
    262. > }
    263.   
    264.   int sk_unshift(_STACK *st, void *data)

include/openssl/x509_vfy.h:124:1: return from a call to sk_X509_OBJECT_push
  122.   
  123.   DEFINE_STACK_OF(X509_LOOKUP)
  124. > DEFINE_STACK_OF(X509_OBJECT)
  125.   
  126.   /* This is a static that defines the function interface */
