crypto/property/property.c:149: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 146, column 30 is not reachable after line 149, column 9.
Showing all 26 steps of the trace


crypto/property/property.c:144:1: start of procedure ossl_method_store_new()
142.   }
143.   
144. > OSSL_METHOD_STORE *ossl_method_store_new(void)
145.   {
146.       OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));

crypto/property/property.c:146:5: 
144.   OSSL_METHOD_STORE *ossl_method_store_new(void)
145.   {
146. >     OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
147.   
148.       if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))

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 false branch
    202.   
    203.       FAILTEST();
    204.       if (allow_customize) {
                   ^
    205.           /*
    206.            * Disallow customization after the first allocation. We only set this

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/property/property.c:148:10: 
146.       OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
147.   
148. >     if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
149.           return 0;
150.   

crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
  109.   }
  110.   
  111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
  112.   {
  113.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:113:9: Taking false branch
  111.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
  112.   {
  113.       if (pthread_once(once, init) != 0)
                 ^
  114.           return 0;
  115.   

crypto/threads_pthread.c:116:5: 
  114.           return 0;
  115.   
  116. >     return 1;
  117.   }
  118.   

crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
  115.   
  116.       return 1;
  117. > }
  118.   
  119.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/property/property.c:148:10: Condition is true
146.       OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
147.   
148.       if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
                ^
149.           return 0;
150.   

crypto/property/property.c:148:10: Taking true branch
146.       OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
147.   
148.       if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
                ^
149.           return 0;
150.   

crypto/property/property.c:149:9: 
147.   
148.       if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
149. >         return 0;
150.   
151.       if (res != NULL) {

OSSL_METHOD_STORE *ossl_method_store_new(void)
{
    OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));
    if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))
        return 0;
    if (res != NULL) {
        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL) {
            OPENSSL_free(res);
            return NULL;
        }
        if ((res->lock = CRYPTO_THREAD_lock_new()) == NULL) {
            OPENSSL_free(res->algs);
            OPENSSL_free(res);
            return NULL;
        }
    }
    return res;
}
['OSSL_METHOD_STORE *ossl_method_store_new(void)\n{\n    OSSL_METHOD_STORE *res = OPENSSL_zalloc(sizeof(*res));\n    if (!RUN_ONCE(&method_store_init_flag, do_method_store_init))\n        return 0;\n    if (res != NULL) {\n        if ((res->algs = ossl_sa_ALGORITHM_new()) == NULL) {\n            OPENSSL_free(res);\n            return NULL;\n        }\n        if ((res->lock = CRYPTO_THREAD_lock_new()) == NULL) {\n            OPENSSL_free(res->algs);\n            OPENSSL_free(res);\n            return NULL;\n        }\n    }\n    return res;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}']