crypto/rand/drbg_lib.c:189: error: NULL_DEREFERENCE
  pointer `drbg` last assigned on line 167 could be null and is dereferenced at line 189, column 9.
Showing all 22 steps of the trace


crypto/rand/drbg_lib.c:162:1: start of procedure rand_drbg_new()
160.    * Returns a pointer to the new DRBG instance on success, NULL on failure.
161.    */
162. > static RAND_DRBG *rand_drbg_new(int secure,
163.                                   int type,
164.                                   unsigned int flags,

crypto/rand/drbg_lib.c:167:23: Condition is true
165.                                   RAND_DRBG *parent)
166.   {
167.       RAND_DRBG *drbg = secure ?
                             ^
168.           OPENSSL_secure_zalloc(sizeof(*drbg)) : OPENSSL_zalloc(sizeof(*drbg));
169.   

crypto/mem_sec.c:131:1: start of procedure CRYPTO_secure_zalloc()
  129.   }
  130.   
  131. > void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
  132.   {
  133.       void *ret = CRYPTO_secure_malloc(num, file, line);

crypto/mem_sec.c:133:5: 
  131.   void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
  132.   {
  133. >     void *ret = CRYPTO_secure_malloc(num, file, line);
  134.   
  135.       if (ret != NULL)

crypto/mem_sec.c:111:1: start of procedure CRYPTO_secure_malloc()
    109.   }
    110.   
    111. > void *CRYPTO_secure_malloc(size_t num, const char *file, int line)
    112.   {
    113.   #ifdef IMPLEMENTED

crypto/mem_sec.c:117:10: Taking true branch
    115.       size_t actual_size;
    116.   
    117.       if (!secure_mem_initialized) {
                    ^
    118.           return CRYPTO_malloc(num, file, line);
    119.       }

crypto/mem_sec.c:118:9: 
    116.   
    117.       if (!secure_mem_initialized) {
    118. >         return CRYPTO_malloc(num, file, line);
    119.       }
    120.       CRYPTO_THREAD_write_lock(sec_malloc_lock);

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:219:1: return from a call to CRYPTO_malloc
      217.   
      218.       return ret;
      219. > }
      220.   
      221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem_sec.c:129:1: return from a call to CRYPTO_secure_malloc
    127.       return CRYPTO_malloc(num, file, line);
    128.   #endif /* IMPLEMENTED */
    129. > }
    130.   
    131.   void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)

crypto/mem_sec.c:135:9: Taking false branch
  133.       void *ret = CRYPTO_secure_malloc(num, file, line);
  134.   
  135.       if (ret != NULL)
                 ^
  136.           memset(ret, 0, num);
  137.       return ret;

crypto/mem_sec.c:137:5: 
  135.       if (ret != NULL)
  136.           memset(ret, 0, num);
  137. >     return ret;
  138.   }
  139.   

crypto/mem_sec.c:138:1: return from a call to CRYPTO_secure_zalloc
  136.           memset(ret, 0, num);
  137.       return ret;
  138. > }
  139.   
  140.   void CRYPTO_secure_free(void *ptr, const char *file, int line)

crypto/rand/drbg_lib.c:167:5: 
165.                                   RAND_DRBG *parent)
166.   {
167. >     RAND_DRBG *drbg = secure ?
168.           OPENSSL_secure_zalloc(sizeof(*drbg)) : OPENSSL_zalloc(sizeof(*drbg));
169.   

crypto/rand/drbg_lib.c:170:9: Taking true branch
168.           OPENSSL_secure_zalloc(sizeof(*drbg)) : OPENSSL_zalloc(sizeof(*drbg));
169.   
170.       if (drbg == NULL) {
               ^
171.           RANDerr(RAND_F_RAND_DRBG_NEW, ERR_R_MALLOC_FAILURE);
172.           goto err;

crypto/rand/drbg_lib.c:171:9: Skipping ERR_put_error(): empty list of specs
169.   
170.       if (drbg == NULL) {
171.           RANDerr(RAND_F_RAND_DRBG_NEW, ERR_R_MALLOC_FAILURE);
               ^
172.           goto err;
173.       }

crypto/rand/drbg_lib.c:188:1: 
186.       return drbg;
187.   
188. > err:
189.       if (drbg->secure)
190.           OPENSSL_secure_free(drbg);

crypto/rand/drbg_lib.c:189:9: Taking false branch
187.   
188.   err:
189.       if (drbg->secure)
               ^
190.           OPENSSL_secure_free(drbg);
191.       else
