crypto/rand/rand_lib.c:138: error: NULL_DEREFERENCE
  pointer `meth` last assigned on line 136 could be null and is dereferenced at line 138, column 9.
Showing all 14 steps of the trace


crypto/rand/rand_lib.c:134:1: start of procedure RAND_add()
132.   }
133.   
134. > void RAND_add(const void *buf, int num, double randomness)
135.   {
136.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:136:5: 
134.   void RAND_add(const void *buf, int num, double randomness)
135.   {
136. >     const RAND_METHOD *meth = RAND_get_rand_method();
137.   
138.       if (meth->add != NULL)

crypto/rand/rand_lib.c:70:1: start of procedure RAND_get_rand_method()
  68.   }
  69.   
  70. > const RAND_METHOD *RAND_get_rand_method(void)
  71.   {
  72.       const RAND_METHOD *tmp_meth = NULL;

crypto/rand/rand_lib.c:72:5: 
  70.   const RAND_METHOD *RAND_get_rand_method(void)
  71.   {
  72. >     const RAND_METHOD *tmp_meth = NULL;
  73.   
  74.       if (!RUN_ONCE(&rand_init, do_rand_init))

crypto/rand/rand_lib.c:74:10: 
  72.       const RAND_METHOD *tmp_meth = NULL;
  73.   
  74. >     if (!RUN_ONCE(&rand_init, do_rand_init))
  75.           return NULL;
  76.   

crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
    103.   }
    104.   
    105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking true branch
    105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)
                   ^
    108.           return 0;
    109.   

crypto/threads_pthread.c:108:9: 
    106.   {
    107.       if (pthread_once(once, init) != 0)
    108. >         return 0;
    109.   
    110.       return 1;

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
    109.   
    110.       return 1;
    111. > }
    112.   
    113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/rand/rand_lib.c:74:10: Condition is false
  72.       const RAND_METHOD *tmp_meth = NULL;
  73.   
  74.       if (!RUN_ONCE(&rand_init, do_rand_init))
                 ^
  75.           return NULL;
  76.   

crypto/rand/rand_lib.c:74:10: Taking true branch
  72.       const RAND_METHOD *tmp_meth = NULL;
  73.   
  74.       if (!RUN_ONCE(&rand_init, do_rand_init))
                 ^
  75.           return NULL;
  76.   

crypto/rand/rand_lib.c:75:9: 
  73.   
  74.       if (!RUN_ONCE(&rand_init, do_rand_init))
  75. >         return NULL;
  76.   
  77.       CRYPTO_THREAD_write_lock(rand_meth_lock);

crypto/rand/rand_lib.c:98:1: return from a call to RAND_get_rand_method
  96.       CRYPTO_THREAD_unlock(rand_meth_lock);
  97.       return tmp_meth;
  98. > }
  99.   
  100.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:138:9: 
136.       const RAND_METHOD *meth = RAND_get_rand_method();
137.   
138. >     if (meth->add != NULL)
139.           meth->add(buf, num, randomness);
140.   }

void RAND_add(const void *buf, int num, double randomness)
{
    const RAND_METHOD *meth = RAND_get_rand_method();
    if (meth->add != NULL)
        meth->add(buf, num, randomness);
}
['void RAND_add(const void *buf, int num, double randomness)\n{\n    const RAND_METHOD *meth = RAND_get_rand_method();\n    if (meth->add != NULL)\n        meth->add(buf, num, randomness);\n}', 'const RAND_METHOD *RAND_get_rand_method(void)\n{\n    const RAND_METHOD *tmp_meth = NULL;\n    if (!RUN_ONCE(&rand_init, do_rand_init))\n        return NULL;\n    CRYPTO_THREAD_write_lock(rand_meth_lock);\n    if (default_RAND_meth == NULL) {\n#ifndef OPENSSL_NO_ENGINE\n        ENGINE *e;\n        if ((e = ENGINE_get_default_RAND()) != NULL\n                && (tmp_meth = ENGINE_get_RAND(e)) != NULL) {\n            funct_ref = e;\n            default_RAND_meth = tmp_meth;\n        } else {\n            ENGINE_finish(e);\n            default_RAND_meth = &openssl_rand_meth;\n        }\n#else\n        default_RAND_meth = &openssl_rand_meth;\n#endif\n    }\n    tmp_meth = default_RAND_meth;\n    CRYPTO_THREAD_unlock(rand_meth_lock);\n    return tmp_meth;\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}']