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


crypto/rand/rand_lib.c:808:1: start of procedure RAND_bytes()
806.   }
807.   
808. > int RAND_bytes(unsigned char *buf, int num)
809.   {
810.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:810:5: 
808.   int RAND_bytes(unsigned char *buf, int num)
809.   {
810. >     const RAND_METHOD *meth = RAND_get_rand_method();
811.   
812.       if (meth->bytes != NULL)

crypto/rand/rand_lib.c:714:1: start of procedure RAND_get_rand_method()
  712.   }
  713.   
  714. > const RAND_METHOD *RAND_get_rand_method(void)
  715.   {
  716.       const RAND_METHOD *tmp_meth = NULL;

crypto/rand/rand_lib.c:716:5: 
  714.   const RAND_METHOD *RAND_get_rand_method(void)
  715.   {
  716. >     const RAND_METHOD *tmp_meth = NULL;
  717.   
  718.       if (!RUN_ONCE(&rand_init, do_rand_init))

crypto/rand/rand_lib.c:718:10: 
  716.       const RAND_METHOD *tmp_meth = NULL;
  717.   
  718. >     if (!RUN_ONCE(&rand_init, do_rand_init))
  719.           return NULL;
  720.   

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 true 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:114:9: 
    112.   {
    113.       if (pthread_once(once, init) != 0)
    114. >         return 0;
    115.   
    116.       return 1;

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/rand/rand_lib.c:718:10: Condition is false
  716.       const RAND_METHOD *tmp_meth = NULL;
  717.   
  718.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  719.           return NULL;
  720.   

crypto/rand/rand_lib.c:718:10: Taking true branch
  716.       const RAND_METHOD *tmp_meth = NULL;
  717.   
  718.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  719.           return NULL;
  720.   

crypto/rand/rand_lib.c:719:9: 
  717.   
  718.       if (!RUN_ONCE(&rand_init, do_rand_init))
  719. >         return NULL;
  720.   
  721.       CRYPTO_THREAD_write_lock(rand_meth_lock);

crypto/rand/rand_lib.c:742:1: return from a call to RAND_get_rand_method
  740.       CRYPTO_THREAD_unlock(rand_meth_lock);
  741.       return tmp_meth;
  742. > }
  743.   
  744.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:812:9: 
810.       const RAND_METHOD *meth = RAND_get_rand_method();
811.   
812. >     if (meth->bytes != NULL)
813.           return meth->bytes(buf, num);
814.       RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);

int RAND_bytes(unsigned char *buf, int num)
{
    const RAND_METHOD *meth = RAND_get_rand_method();
    if (meth->bytes != NULL)
        return meth->bytes(buf, num);
    RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
    return -1;
}
['int RAND_bytes(unsigned char *buf, int num)\n{\n    const RAND_METHOD *meth = RAND_get_rand_method();\n    if (meth->bytes != NULL)\n        return meth->bytes(buf, num);\n    RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);\n    return -1;\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 = &rand_meth;\n        }\n#else\n        default_RAND_meth = &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}']