crypto/provider_core.c:196: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 190, column 17 is not reachable after line 196, column 9.
Showing all 47 steps of the trace


crypto/provider_core.c:185:1: start of procedure provider_new()
183.    */
184.   
185. > static OSSL_PROVIDER *provider_new(const char *name,
186.                                      OSSL_provider_init_fn *init_function)
187.   {

crypto/provider_core.c:188:5: 
186.                                      OSSL_provider_init_fn *init_function)
187.   {
188. >     OSSL_PROVIDER *prov = NULL;
189.   
190.       if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL

crypto/provider_core.c:190:9: 
188.       OSSL_PROVIDER *prov = NULL;
189.   
190. >     if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
191.   #ifndef HAVE_ATOMICS
192.           || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
  226.   }
  227.   
  228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230. >     void *ret = CRYPTO_malloc(num, file, line);
  231.   
  232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
    190.   #endif
    191.   
    192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194.       void *ret = NULL;

crypto/mem.c:194:5: 
    192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194. >     void *ret = NULL;
    195.   
    196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:200:9: Taking false branch
    198.           return malloc_impl(num, file, line);
    199.   
    200.       if (num == 0)
                   ^
    201.           return NULL;
    202.   

crypto/mem.c:204:9: Taking true branch
    202.   
    203.       FAILTEST();
    204.       if (allow_customize) {
                   ^
    205.           /*
    206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
    208.            * allocation.
    209.            */
    210. >         allow_customize = 0;
    211.       }
    212.   #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)

crypto/mem.c:221:5: 
    219.       }
    220.   #else
    221. >     (void)(file); (void)(line);
    222.       ret = malloc(num);
    223.   #endif

crypto/mem.c:221:19: 
    219.       }
    220.   #else
    221. >     (void)(file); (void)(line);
    222.       ret = malloc(num);
    223.   #endif

crypto/mem.c:222:5: 
    220.   #else
    221.       (void)(file); (void)(line);
    222. >     ret = malloc(num);
    223.   #endif
    224.   

crypto/mem.c:225:5: 
    223.   #endif
    224.   
    225. >     return ret;
    226.   }
    227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
    224.   
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
  231.   
  232.       FAILTEST();
  233.       if (ret != NULL)
                 ^
  234.           memset(ret, 0, num);
  235.       return ret;

crypto/mem.c:234:9: 
  232.       FAILTEST();
  233.       if (ret != NULL)
  234. >         memset(ret, 0, num);
  235.       return ret;
  236.   }

crypto/mem.c:235:5: 
  233.       if (ret != NULL)
  234.           memset(ret, 0, num);
  235. >     return ret;
  236.   }
  237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
  234.           memset(ret, 0, num);
  235.       return ret;
  236. > }
  237.   
  238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/provider_core.c:190:9: Taking false branch
188.       OSSL_PROVIDER *prov = NULL;
189.   
190.       if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
               ^
191.   #ifndef HAVE_ATOMICS
192.           || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL

crypto/provider_core.c:194:13: 
192.           || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
193.   #endif
194. >         || !ossl_provider_upref(prov) /* +1 One reference to be returned */
195.           || (prov->name = OPENSSL_strdup(name)) == NULL) {
196.           ossl_provider_free(prov);

crypto/provider_core.c:205:1: start of procedure ossl_provider_upref()
  203.   }
  204.   
  205. > int ossl_provider_upref(OSSL_PROVIDER *prov)
  206.   {
  207.       int ref = 0;

crypto/provider_core.c:207:5: 
  205.   int ossl_provider_upref(OSSL_PROVIDER *prov)
  206.   {
  207. >     int ref = 0;
  208.   
  209.       CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);

crypto/provider_core.c:209:5: 
  207.       int ref = 0;
  208.   
  209. >     CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
  210.       return ref;
  211.   }

include/internal/refcount.h:33:1: start of procedure CRYPTO_UP_REF()
    31.   typedef _Atomic int CRYPTO_REF_COUNT;
    32.   
    33. > static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
    34.   {
    35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;

include/internal/refcount.h:35:5: 
    33.   static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
    34.   {
    35. >     *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
    36.       return 1;
    37.   }

include/internal/refcount.h:36:5: 
    34.   {
    35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
    36. >     return 1;
    37.   }
    38.   

include/internal/refcount.h:37:1: return from a call to CRYPTO_UP_REF
    35.       *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
    36.       return 1;
    37. > }
    38.   
    39.   /*

crypto/provider_core.c:210:5: 
  208.   
  209.       CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
  210. >     return ref;
  211.   }
  212.   

crypto/provider_core.c:211:1: return from a call to ossl_provider_upref
  209.       CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
  210.       return ref;
  211. > }
  212.   
  213.   OSSL_PROVIDER *ossl_provider_new(OPENSSL_CTX *libctx, const char *name,

crypto/provider_core.c:194:13: Taking false branch
192.           || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
193.   #endif
194.           || !ossl_provider_upref(prov) /* +1 One reference to be returned */
                   ^
195.           || (prov->name = OPENSSL_strdup(name)) == NULL) {
196.           ossl_provider_free(prov);

crypto/provider_core.c:195:12: 
193.   #endif
194.           || !ossl_provider_upref(prov) /* +1 One reference to be returned */
195. >         || (prov->name = OPENSSL_strdup(name)) == NULL) {
196.           ossl_provider_free(prov);
197.           CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);

crypto/o_str.c:27:1: start of procedure CRYPTO_strdup()
  25.   }
  26.   
  27. > char *CRYPTO_strdup(const char *str, const char* file, int line)
  28.   {
  29.       char *ret;

crypto/o_str.c:31:9: Taking false branch
  29.       char *ret;
  30.   
  31.       if (str == NULL)
                ^
  32.           return NULL;
  33.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);

crypto/o_str.c:33:5: 
  31.       if (str == NULL)
  32.           return NULL;
  33. >     ret = CRYPTO_malloc(strlen(str) + 1, file, line);
  34.       if (ret != NULL)
  35.           strcpy(ret, str);

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
    190.   #endif
    191.   
    192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194.       void *ret = NULL;

crypto/mem.c:194:5: 
    192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194. >     void *ret = NULL;
    195.   
    196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:197:32: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                          ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    198.           return malloc_impl(num, file, line);
                   ^
    199.   
    200.       if (num == 0)

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
    224.   
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:34:9: Taking false branch
  32.           return NULL;
  33.       ret = CRYPTO_malloc(strlen(str) + 1, file, line);
  34.       if (ret != NULL)
                ^
  35.           strcpy(ret, str);
  36.       return ret;

crypto/o_str.c:36:5: 
  34.       if (ret != NULL)
  35.           strcpy(ret, str);
  36. >     return ret;
  37.   }
  38.   

crypto/o_str.c:37:1: return from a call to CRYPTO_strdup
  35.           strcpy(ret, str);
  36.       return ret;
  37. > }
  38.   
  39.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/provider_core.c:195:12: Taking true branch
193.   #endif
194.           || !ossl_provider_upref(prov) /* +1 One reference to be returned */
195.           || (prov->name = OPENSSL_strdup(name)) == NULL) {
                  ^
196.           ossl_provider_free(prov);
197.           CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);

crypto/provider_core.c:196:9: Skipping ossl_provider_free(): empty list of specs
194.           || !ossl_provider_upref(prov) /* +1 One reference to be returned */
195.           || (prov->name = OPENSSL_strdup(name)) == NULL) {
196.           ossl_provider_free(prov);
               ^
197.           CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
198.           return NULL;
