crypto/asn1/x_info.c:78: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 68, column 11 is not reachable after line 78, column 9.
Showing all 56 steps of the trace


crypto/asn1/x_info.c:64:1: start of procedure X509_INFO_new()
62.   #include <openssl/x509.h>
63.   
64. > X509_INFO *X509_INFO_new(void)
65.   {
66.       X509_INFO *ret;

crypto/asn1/x_info.c:68:5: 
66.       X509_INFO *ret;
67.   
68. >     ret = OPENSSL_zalloc(sizeof(*ret));
69.       if (ret == NULL) {
70.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
  144.   }
  145.   
  146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148. >     void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    124.           return malloc_impl(num, file, line);
    125.   

crypto/mem.c:126:9: Taking false branch
    124.           return malloc_impl(num, file, line);
    125.   
    126.       if (num <= 0)
                   ^
    127.           return NULL;
    128.   

crypto/mem.c:129:5: 
    127.           return NULL;
    128.   
    129. >     allow_customize = 0;
    130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
    137.       }
    138.   #else
    139. >     osslargused(file); osslargused(line);
    140.       ret = malloc(num);
    141.   #endif

crypto/mem.c:139:24: 
    137.       }
    138.   #else
    139. >     osslargused(file); osslargused(line);
    140.       ret = malloc(num);
    141.   #endif

crypto/mem.c:140:5: 
    138.   #else
    139.       osslargused(file); osslargused(line);
    140. >     ret = malloc(num);
    141.   #endif
    142.   

crypto/mem.c:143:5: 
    141.   #endif
    142.   
    143. >     return ret;
    144.   }
    145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
    142.   
    143.       return ret;
    144. > }
    145.   
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
  148.       void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)
                 ^
  151.           memset(ret, 0, num);
  152.       return ret;

crypto/mem.c:151:9: 
  149.   
  150.       if (ret != NULL)
  151. >         memset(ret, 0, num);
  152.       return ret;
  153.   }

crypto/mem.c:152:5: 
  150.       if (ret != NULL)
  151.           memset(ret, 0, num);
  152. >     return ret;
  153.   }
  154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
  151.           memset(ret, 0, num);
  152.       return ret;
  153. > }
  154.   
  155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/x_info.c:69:9: Taking false branch
67.   
68.       ret = OPENSSL_zalloc(sizeof(*ret));
69.       if (ret == NULL) {
              ^
70.           ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);
71.           return NULL;

crypto/asn1/x_info.c:74:5: 
72.       }
73.   
74. >     ret->references = 1;
75.   
76.       ret->lock = CRYPTO_THREAD_lock_new();

crypto/asn1/x_info.c:76:5: 
74.       ret->references = 1;
75.   
76. >     ret->lock = CRYPTO_THREAD_lock_new();
77.       if (ret->lock == NULL) {
78.           X509_INFO_free(ret);

crypto/threads_pthread.c:55:1: start of procedure CRYPTO_THREAD_lock_new()
  53.   #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS)
  54.   
  55. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  56.   {
  57.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));

crypto/threads_pthread.c:57:5: 
  55.   CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  56.   {
  57. >     CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  58.       if (lock == NULL)
  59.           return NULL;

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking true branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:123:32: Taking true branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                            ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:124:9: Skipping __function_pointer__(): unresolved function pointer
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
      124.           return malloc_impl(num, file, line);
                     ^
      125.   
      126.       if (num <= 0)

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:58:9: Taking false branch
  56.   {
  57.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  58.       if (lock == NULL)
                ^
  59.           return NULL;
  60.   

crypto/threads_pthread.c:61:9: Taking true branch
  59.           return NULL;
  60.   
  61.       if (pthread_rwlock_init(lock, NULL) != 0) {
                ^
  62.           OPENSSL_free(lock);
  63.           return NULL;

crypto/threads_pthread.c:62:9: 
  60.   
  61.       if (pthread_rwlock_init(lock, NULL) != 0) {
  62. >         OPENSSL_free(lock);
  63.           return NULL;
  64.       }

crypto/mem.c:210:1: start of procedure CRYPTO_free()
    208.   }
    209.   
    210. > void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:212:9: Taking false branch
    210.   void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    213.           free_impl(str, file, line);
    214.           return;

crypto/mem.c:226:5: 
    224.       }
    225.   #else
    226. >     free(str);
    227.   #endif
    228.   }

crypto/mem.c:228:1: return from a call to CRYPTO_free
    226.       free(str);
    227.   #endif
    228. > }
    229.   
    230.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:63:9: 
  61.       if (pthread_rwlock_init(lock, NULL) != 0) {
  62.           OPENSSL_free(lock);
  63. >         return NULL;
  64.       }
  65.   

crypto/threads_pthread.c:67:1: return from a call to CRYPTO_THREAD_lock_new
  65.   
  66.       return lock;
  67. > }
  68.   
  69.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

crypto/asn1/x_info.c:77:9: Taking true branch
75.   
76.       ret->lock = CRYPTO_THREAD_lock_new();
77.       if (ret->lock == NULL) {
              ^
78.           X509_INFO_free(ret);
79.           return NULL;

crypto/asn1/x_info.c:78:9: 
76.       ret->lock = CRYPTO_THREAD_lock_new();
77.       if (ret->lock == NULL) {
78. >         X509_INFO_free(ret);
79.           return NULL;
80.       }

crypto/asn1/x_info.c:85:1: start of procedure X509_INFO_free()
  83.   }
  84.   
  85. > void X509_INFO_free(X509_INFO *x)
  86.   {
  87.       int i;

crypto/asn1/x_info.c:89:9: Taking false branch
  87.       int i;
  88.   
  89.       if (x == NULL)
                ^
  90.           return;
  91.   

crypto/asn1/x_info.c:92:5: 
  90.           return;
  91.   
  92. >     CRYPTO_atomic_add(&x->references, -1, &i, x->lock);
  93.       REF_PRINT_COUNT("X509_INFO", x);
  94.       if (i > 0)

crypto/threads_pthread.c:151:1: start of procedure CRYPTO_atomic_add()
    149.   }
    150.   
    151. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
    152.   {
    153.   #ifdef __ATOMIC_RELAXED

crypto/threads_pthread.c:154:5: 
    152.   {
    153.   #ifdef __ATOMIC_RELAXED
    154. >     *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);
    155.   #else
    156.       if (!CRYPTO_THREAD_write_lock(lock))

crypto/threads_pthread.c:166:5: 
    164.   #endif
    165.   
    166. >     return 1;
    167.   }
    168.   

crypto/threads_pthread.c:167:1: return from a call to CRYPTO_atomic_add
    165.   
    166.       return 1;
    167. > }
    168.   
    169.   #endif

crypto/asn1/x_info.c:94:9: Taking true branch
  92.       CRYPTO_atomic_add(&x->references, -1, &i, x->lock);
  93.       REF_PRINT_COUNT("X509_INFO", x);
  94.       if (i > 0)
                ^
  95.           return;
  96.       REF_ASSERT_ISNT(i < 0);

crypto/asn1/x_info.c:95:9: 
  93.       REF_PRINT_COUNT("X509_INFO", x);
  94.       if (i > 0)
  95. >         return;
  96.       REF_ASSERT_ISNT(i < 0);
  97.   

crypto/asn1/x_info.c:104:1: return from a call to X509_INFO_free
  102.       CRYPTO_THREAD_lock_free(x->lock);
  103.       OPENSSL_free(x);
  104. > }
